Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: DBI execute() args in array format (or similar) possible?

by dws (Chancellor)
on Aug 12, 2002 at 19:57 UTC ( #189611=note: print w/replies, xml ) Need Help??


in reply to Re: DBI execute() args in array format (or similar) possible?
in thread DBI execute() args in array format (or similar) possible?

While the docs say that specifying a value as a parameter to $dbh->execute() will automatically quote it appropriately, I just haven't had much luck with my attempts.

Which DBD are you using, and can you provide an example of where execute() fails to quote appropriately?

  • Comment on Re: Re: DBI execute() args in array format (or similar) possible?

Replies are listed 'Best First'.
Re: Re: Re: DBI execute() args in array format (or similar) possible?
by aufrank (Pilgrim) on Aug 12, 2002 at 20:27 UTC

    apparently I was very wrong... any problems I had previously were simply a result of my own insuffiencies. I had always assumed this to be the case, but I mentioned my problems because the only solution I came to when I couldn't get placeholders to work was to take them out and thought the original poster might come to a similar place.

    The problems I was referring to were with using DBI and the ODBC DBD to perform UPDATE statements on MS Access DBs using placeholders. I just wrote up a test statement, though, and had no problems. Sorry to pass bogus information, perhaps this code can help the original poster anyway...

    my @updates = map {$dbh->quote_identifier($_) . ' = (?)'} ('call 1 com +ment', 'call 2 comment', 'call 3 comment', 'call 4 comment'); my $name_field = $dbh->quote_identifier('last name'); my $update_string = join ", ", @updates; my $sql = qq{UPDATE $table SET $update_string WHERE $name_field = (?)} +; print "$sql\n"; my $sth = $dbh->prepare_cached($sql); $sth->execute('foo','bar','baz','qux','smith');

    I was thoroughly wrong, but maybe the code will end up helping where my previous post couldn't :)
    --au

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2023-01-27 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?