I think she wants case insensitive search. I do this by calling search_literal at the moment:
# predefined resultset for my device listing template
my $rs_devices = $schema->resultset('Device')->search(undef, {
prefetch => [
[ 'rel_monitor', 'rel_location', 'rel_device_type' ],
{
rel_division => 'rel_customer',
},
],
order_by => [ 'me.name' ],
});
# for the lost & found page:
$search_devices = "
me.fk_monitor != 3
AND (
UPPER(me.name) LIKE $rtxt
OR UPPER(me.alias) LIKE $rtxt
OR UPPER(me.snmplocation) LIKE $rtxt
OR UPPER(me.hostid) LIKE $rtxt
OR me.ipaddr LIKE $rtxt
OR UPPER(rel_location.zip) LIKE $rtxt
OR UPPER(rel_location.city) LIKE $rtxt
OR UPPER(rel_location.street) LIKE $rtxt
OR me.serialnumber LIKE $rtxt
OR me.hostid LIKE $rtxt
)
";
$rs_devices_search = $rs_devices->search_literal($search_devices);
I know mst hates search_literal for some reason which is unknown to be (besides
not being DBD independent for more complex queries) but that’s the easiest way
to do it imho.
-Alex
-----Original Message-----
From: Jason Kohles [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 30, 2008 4:52 PM
To: DBIx::Class user and developer list
Subject: Re: [Dbix-class] upper case search
On Jan 30, 2008, at 8:00 AM, Jess Robinson wrote:
>
>
> On Tue, 29 Jan 2008, Jennifer Ahn wrote:
>
>> hello all!
>>
>> does anybody know how to implement the sql function UPPER when i
>> call the dbix::schema->search method?
>>
>
> Please give an example of the actual SQL you want to produce.. my
> ESP is broken..
>
I suspect she is looking for something along the lines of 'SELECT *
FROM table WHERE foo = UPPER( ? )', and has failed to find the entry
entitled 'Using database functions or stored procedures' in
DBIx::Class::Manual::Cookbook.
--
Jason Kohles, RHCA RHCDS RHCE
[EMAIL PROTECTED] - http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
