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

stephenmoy smoy at stern.nyu.edu
Wed Apr 24 14:56:06 GMT 2013


Has anybody tried searching using LOWER on more than one column?

Such as:

my $srch = "van";
my @students  = $schema->resultset( 'GraduateStudent' )->search(
                              -or {  'LOWER( me.email )' => $srch,
                                      'LOWER( me.uid )'    => $srch,
                                      'LOWER( me.st_nm )' => { like => '%' .
$srch . '%' },
                                   },
                              { order_by => 'me.st_nm' }
);

gives an error:

DBIx::Class::ResultSet::search(): DBI Exception: DBD::ODBC::st bind_param
failed: [unixODBC][Ingres][Ingres ODBC Driver]SQL data type out of range
(SQL-HY004) [for Statement "SELECT me.ssn, me.email, me.st_nm,
me.c_xp_grd_dt, me.pn_f_rg, me.c_mj, me.aa_fl_p, me.ps_phone, me.c_dg,
me.nyu_sc, me.pn_mj FROM rr01st me WHERE ( ( LOWER( me.email ) = ? OR LOWER(
me.ssn ) = ? OR LOWER( me.st_nm ) LIKE ? ) ) ORDER BY me.st_nm" with
ParamValues: 1='van', 2='van', 3=undef]

Thanks in advance,
Stephen




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



More information about the DBIx-Class mailing list