Errors and RWDBStatus
When an error or warning is generated by an Access Module call to the MySQL API, information about the event is retrieved via calls to either mysql_error() and mysql_errno(), or mysql_stmt_error() and mysql_stmt_errno(); this information is then transferred to an RWDBStatus. This RWDBStatus object is passed as a parameter to the installed error handler. The following list provides the format that RWDBStatus uses to describe events reported by MySQL:
*errorCode: RWDBStatus::serverError if an error occurred, or RWDBStatus::ok if a warning is being generated
*message: "SQL Execution call failed" if an error occurred, or "Success with info" if a warning is being generated
*vendorMessage1: the native error code parameter output from the mysql_error() or mysql_stmt_error() call, for example "Invalid Table"
*vendorMessage2: [not used]
*vendorError1: the native error code parameter output from the mysql_errno() or mysql_stmt_errno() call
*vendorError2: [not used]
An application can use the mapping shown previously to write an error handler that reports errors on cerr and issues warnings on clog. For example:
 
void myErrorHandler(const RWDBStatus& stat)
{
if (stat.errorCode() != RWDBStatus::ok) // Errors
cerr << stat.vendorMessage1();
else // Warnings
clog << stat.vendorMessage1();
}
All errors associated with the status will be reported.