Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Date: 2008jun19 Language: perl Library: 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 codeNotice 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
Add a commentSign in to add a comment