Case insensitive searches

Class::DBI provides two simple search methods for you: the normal search and search_like.

Internally each of these is a single line method:

sub search     { shift->_do_search("="  => @_) } sub search_like { shift->_do_search(LIKE => @_) }

This simply passes on your search criteria and prepends a token that will become the search term in the SQL ("column = ?" or "column LIKE ?").

This means that if your database supports further types of search terms you can add trivial methods to work with them:

sub search_ilike { shift->_do_search(ILIKE => @_) } sub search_regex { shift->_do_search(RLIKE => @_) }

This involves calling an undocumented private method, which is a little naughty. Future versions of Class::DBI may have a nicer interface to this.