Database Debuging issue, error not logged |
|||
|---|---|---|---|
| Date: | 07/21/2008 | Severity: | Minor |
| Status: | Resolved | Reporter: | XtraFile |
| Version: | 1.7.0 SVN | ||
| Keywords: | Libraries, Database Class | ||
| Forum Thread: | http://codeigniter.com/forums/viewthread/85781/ | ||
Description
When queries fail(im personally using AR) the database code attempts to log the exact error message. Unfortunately on some database engines(MySQL, MySQLi, etc.) once you retrive 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:
This 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
Expected Result
Actual Result
Comment on Bug Report
| Posted by: XtraFile on 21 July 2008 3:12am | |
|
|
Forum thread: http://codeigniter.com/forums/viewthread/85781/ |
| Posted by: Jon L on 29 September 2008 11:50pm | |
|
|
I can verify this bug, I was actually visiting here to make the same report Using CI 1.6.3 |
