Hi Bill,

I recognise the problem you describe. It would indeed be convenient to
have a list of (common) errors, so you can anticipate on it...

However, with eval you can generate error-messages yourself. Here a
snippet of code:

# Build SQL-statement
$sql = "INSERT INTO $table($fields) VALUES($values)";

eval {
    $sth = $dbh->prepare($sql)  	|| die $DBI::errstr;
    $sth->execute 		|| die $DBI::errstr;
    $dbh->commit 		|| die $DBI::errstr;
};

if ( $@ ) { # Catch the errstr
    $dbh->rollback;
    $error = "Error detected when adding record to database...";
}


Hope this will help.


-Wil.


Reply via email to