Fixed issue #105 SQL log errors
Enabled logging database query errors even if $db_debug is not enabled.
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index f3e824d..300ca29 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -251,9 +251,10 @@
 	{
 		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 @@
 			// 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,