[odb-users] Re: If I want to do case insensetive search do I
need to make the case lower myself in a string or can ODB issue an case
insensetive lookup?
Boris Kolpackov
boris at codesynthesis.com
Wed Jul 10 07:38:36 EDT 2013
Hi Rafal,
Rafal Gm <grasmanek94 at gmail.com> writes:
> I have created a username-to-userid table/class but it seems it doesn't
> support case insensetive lookup, which I am thinking : do I need to make
> all the strings lowecase myself or does ODB provide a feature?
No, ODB doesn't provide such a feature. You could probably create a
native query condition that acomplishes this, but it is easier (and
also better, from the performance standpoint) to do it at the
application level.
> Also, doing this in the class CTOR doesn't help:
>
> user_resolver (std::string nickname, user* User): User_(User)
> {
> std::transform(nickname.begin(), nickname.end(), nickname_.begin(), ::tolower);
> }
Of couser it wouldn't since you are up-casing the parameter and never
assign it to the data member (nickname_).
Boris
More information about the odb-users
mailing list