[Dbix-class] RE: Best practice for case-insensitive searches

stephenmoy smoy at stern.nyu.edu
Wed Apr 24 17:40:25 GMT 2013


Sorry Alex, I left out the '=>' when I copied the query.

I tried the examples in the SQL::Abstract docs as well, but still in each
case, any multiple 'LOWER' functions gave an error.

I.E.:  these work fine:
A) my @students = $schema->resultset( 'GraduateStudent' )->search(
                            -or => [ 'LOWER( me.email )' => $srch,
                                        'me.uid'                 => $srch,
                            ]
);

B) my @students  = $schema->resultset( 'GraduateStudent' )->search({ -or =>
[
                                \[ 'LOWER(email) = ?', [ plain_value =>
$srch ] ],
                                uid => $srch,
                          ]});


these don't work:
C) my @students = $schema->resultset( 'GraduateStudent' )->search(
                            -or => [ 'LOWER( me.email )' => $srch,
                                        'LOWER( me.uid )'    => $srch,
                            ]
);

D) my @students  = $schema->resultset( 'GraduateStudent' )->search({ -or =>
[
                                \[ 'LOWER(email) = ?', [ plain_value =>
$srch ] ],
                                \[ 'LOWER(uid) = ?', [ plain_value => $srch
] ],
                          ]});

I wonder if this is a DBIC issue or an Ingres ODBC issue.


Best,
Stephen



--
View this message in context: http://dbix-class.35028.n2.nabble.com/Best-practice-for-case-insensitive-searches-tp5963279p7578139.html
Sent from the DBIx-Class mailing list archive at Nabble.com.



More information about the DBIx-Class mailing list