At 12:04 PM +1000 6/15/01, M Felipe wrote:
>I need help on testing the database for errors. Basically im writing a perl
>script to operate my database. When i open the database, i need it to return
>an error code if successful. steps such as:
and reading the information on checking for errors. You want to know
about the PrintError and RaiseError attributes.
>check for error (did database open?)
>if error print error message
>else print successful.
>$dbh = DBI->connect("DBI:mysql:dbname","user","password");
$dbh will be undef if an error occurred (if RaiseError isn't enabled).
>$sth = $dbh->prepare("SELECT username from MyTable");
$sth will be undef if an error occurred (again, if RaiseError isn't enabled).
>(error checking here)
>Basically on the error checking part, if successful $errorcode = 0 or if
>there is error $errorCode = 1;
Paul DuBois, paul@stripped