Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: SQL::Abstract not working right

by jdtoronto (Prior)
on Oct 10, 2006 at 15:52 UTC ( [id://577432]=note: print w/replies, xml ) Need Help??


in reply to SQL::Abstract not working right

data67,

Why would you want some default behaviour of the LIKE? If you look in the SQL::Abstract doc's you will find:

But, this is probably not what you want in this case (look at it). So +the hashref can also contain multiple pairs, in which case it is expa +nded into an AND of its elements: my %where = ( user => 'nwiger', status => { '!=', 'completed', -not_like => 'pending%' } ); # Or more dynamically, like from a form $where{user} = 'nwiger'; $where{status}{'!='} = 'completed'; $where{status}{'-not_like'} = 'pending%'; # Both generate this $stmt = "WHERE user = ? AND status != ? AND status NOT LIKE ?"; @bind = ('nwiger', 'completed', 'pending%');
Which indicates that you need to provide your own wild-cards. The module will HELP you create complex SQL, but it doesn't do absolutely everyting for you. In time you may in fact be thanksful it works this way. I am :)

jdtoronto

Replies are listed 'Best First'.
Re^2: SQL::Abstract not working right
by data67 (Monk) on Oct 10, 2006 at 20:36 UTC
    Thank you!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://577432]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-25 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found