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

Eden Cardim edencardim at gmail.com
Wed Jan 26 19:18:43 GMT 2011


>>>>> "Winfried" == Winfried Neessen <winfried at neessen.net> writes:

    Winfried> Hi, I’d like to do an case-insensitive search on one of my
    Winfried> database tables with DBIx::Class. As I haven’t
    Winfried> found any documentation about case-insensitive search, I
    Winfried> am wondering what’s the best practice
    Winfried> to do so.

    Winfried> What I would usually do with the regular DBI modul, is to
    Winfried> create a simple query like this:

    Winfried> SELECT t.id FROM table t WHERE LOWER( t.my_col ) = ‘<my search string>’;
    Winfried> Any idea or thought-provoking impulse advise is much appreciated.

$rs->search({ 'LOWER(me.my_col)' => 'my search string' })

-- 
Eden Cardim
Software Engineer
Shadowcat Systems Ltd.
http://www.shadowcat.co.uk
http://blog.edencardim.com



More information about the DBIx-Class mailing list