diff options
author | Greg Aker <greg@gregaker.net> | 2011-08-31 08:01:33 +0200 |
---|---|---|
committer | Greg Aker <greg@gregaker.net> | 2011-08-31 08:01:33 +0200 |
commit | 70fb279d1b03098a3a1951a2ee10542867c8e1ba (patch) | |
tree | 82f78b4ba1cd58f71169e8bf702bf1926808c5bf /system/database/DB_driver.php | |
parent | b50df5f018176c0cd0ad498e9c710a2b0b016a80 (diff) | |
parent | d2018ee8ae967cafbd8315ba9ea45f58150bcffe (diff) |
Merge pull request #350 from splitfeed/develop
Fixed issue #105 SQL log errors
Diffstat (limited to 'system/database/DB_driver.php')
-rw-r--r-- | system/database/DB_driver.php | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index f3e824daa..300ca2977 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -251,9 +251,10 @@ class CI_DB_driver { { if ($sql == '') { + log_message('error', 'Invalid query: '.$sql); + if ($this->db_debug) { - log_message('error', 'Invalid query: '.$sql); return $this->display_error('db_invalid_query'); } return FALSE; @@ -306,21 +307,23 @@ class CI_DB_driver { // This will trigger a rollback if transactions are being used $this->_trans_status = FALSE; + // Grab the error number and message now, as we might run some + // additional queries before displaying the error + $error_no = $this->_error_number(); + $error_msg = $this->_error_message(); + + // Log errors + log_message('error', 'Query error: '.$error_msg); + if ($this->db_debug) { - // grab the error number and message now, as we might run some - // additional queries before displaying the error - $error_no = $this->_error_number(); - $error_msg = $this->_error_message(); - // We call this function in order to roll-back queries // if transactions are enabled. If we don't call this here // the error message will trigger an exit, causing the // transactions to remain in limbo. $this->trans_complete(); - // Log and display errors - log_message('error', 'Query error: '.$error_msg); + // Display errors return $this->display_error( array( 'Error Number: '.$error_no, |