Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How can I make DBI's prepare() fail? [MySQL]

by kschwab (Vicar)
on Dec 23, 2018 at 16:32 UTC ( [id://1227643]=note: print w/replies, xml ) Need Help??


in reply to How can I make DBI's prepare() fail? [MySQL]

You can make it fail if you enable server-side prepare:
$dbh = DBI->connect( "DBI:mysql:database=test;host=localhost;mysql_server_prepare=1" );
Then, try to prepare some invalid SQL. I used $sth->prepare("? WHEE") and got this:
DBD::mysql::db prepare failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? WHEE' at line 1 at test.pl line 9.
prepare failed at test.pl line 11.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-24 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found