Welcome Guest, Not a member yet? Register   Sign In
Database Debuging issue, error not logged

When queries fail(I'm personally using AR) the database code attempts to log the exact error message. Unfortunately on some database engines(MySQL, MySQLi, etc.) once you retrieve the error message it clears the message for any future attempts to access it via included functions. This results in log messages like the following:
ERROR - 2008-07-21 03:51:13 --> Query error:

The log is missing the actual error returned from the engine. To fix this you have to use the first variable that accesses the error message, in this case $error_msg in database/DB_driver.php on line 316.

The logging attempt on line 325 calls the _error_message() function again, returning an empty string on some systems. This is resolved by changing that line to the following:
log_message('error', 'Query error: '.$error_msg);
Utilizing the earlier call to retrieve the query error string.

I have included a patch to the latest SVN revision, 1260: http://xtrafile.com/uploads/DB_driver.php.patch

Theme © iAndrew 2016 - Forum software by © MyBB