I have this code, which fails to report an error when I deliberately use a non existing database tabel:
use DBI; # Load the DBI module
### Perform the connection using the Oracle driver
my $dbh = DBI->connect( "dbi:mysql:MYDB:localhost:3306", "NYUSER", "MY
+PASS", {
PrintError => 0,
RaiseError => 0
} ) or die "Can't connect to the database: $DBI::errstr\n";
### Prepare a SQL statement for execution
my $sth = $dbh->prepare( "UPDATE user_settingsX set `language`=? WHERE
+ `username` = ?" )
or die "Can't prepare SQL statement: $DBI::errstr\n";
### Execute the statement in the database
$sth->execute("fr", "admin")
or die "Can't execute SQL statement: ",$sth->errstr,"\n";
## I also tried: "Can't execute SQL statement: $DBI::errstr\n";
### Disconnect from the database
$dbh->disconnect
or warn "Error disconnecting: $DBI::errstr\n";
exit;
I would expect the an error message telling me that the tabel "user_settingsX" does not exist, but the errstr is undef.
I'm using:
- Windows 7
- strawberryperl 5, version 18, subversion 1 (v5.18.1) built for MSWin32-x64-multi-thread
- DBD::mysql 4.023
- DBI 1.628
s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.