Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: DBI Conundrum Using CGI::App

by eric256 (Parson)
on Jul 06, 2006 at 19:45 UTC ( [id://559657]=note: print w/replies, xml ) Need Help??


in reply to DBI Conundrum Using CGI::App

If your media code is a number could it be failing because the number is quoted? I tend to use ? instead of quote because i think it does the right thing more often but that might just be my ignorance ;) Either way you should verify that the SQL getting generated is what you expect and that the prepare isn't failing, i've had prepare fail pretty silently in the past. Check your error logs and print out the SQL it generates to make sure that is all working as expected.


___________
Eric Hodges

Replies are listed 'Best First'.
Re^2: DBI Conundrum Using CGI::App
by Tanktalus (Canon) on Jul 06, 2006 at 19:50 UTC

    Your ignorance? I think that the rule is that you only quote when you have to, and bind your parameters at all other times. Which pretty much means a borked driver, I think, where it doesn't handle quoting for you, and neither does the database backend (if any). So, if anything, your only ignorance might be saying you're ignorant about using ? instead of quote ;-)

    Update: ok, that might have been confusing. You're absolutely right - use ? over quote(). Everytime. Unless, of course, the DBD doesn't support ?.

      Jsut to clafiy, because now you've confused me: I use ? and it seems to quote exactly when i would expect it to. Which means treating numbers correctly. I avoid ->quote() as much as possible becuase it didnt' seem to DWIM as often as ? did and ? looks better to me. ;) So I think that the OP might need to say column="$quoted_string" or column  = ? and pass it an unquoted string.


      ___________
      Eric Hodges

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-24 21:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found