Date: 2008jun19
Language: perl
Platform: DBI
Q. How do I know what went wrong with my sql query?
A. Perl's DBI has *three* function for you:
$number = $dbh->err(); # Gets the error number
$str = $dbh->errstr(); # In english
$str = $dbh->state(); # SQL 5 character code
Notice that they require a handle so what to do when a connect()
fails and you don't get a handle? In that case use:
$number = DBI::err(); # Gets the error number
$str = DBI::errstr(); # In english
$str = DBI::state(); # SQL 5 character code
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment