- }
-
- private function throwOrLog(Exception $ex) {
- if($this->exceptions) {
- throw $ex;
- } else {
- logger('dba: '.$ex->getMessage());
- }
- }
-
- /**
- * starts a transaction. Transactions need to be finished with
- * commit() or rollback(). Please mind that the db table engine may
- * not support this.
- */
- public function beginTransaction() {\r
- if($this->mysqli) {\r
- return $this->db->autocommit(false);\r
- } else {\r
- //no transaction support in mysql module...
- mysql_query('SET AUTOCOMMIT = 0;', $db); \r
- }\r
- }
-
- /**
- * rollback a transaction. So, rollback anything that was done since the last call
- * to beginTransaction().
- */
- public function rollback() {\r
- if($this->mysqli) {\r
- return $this->db->rollback();\r
- } else {\r
- //no transaction support in mysql module...
- mysql_query('ROLLBACK;', $db);\r
- }
- $this->stopTransaction(); \r
+
+ $str = 'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg
+ . (($this->error) ? ' error: ' . $this->error : '')
+ . EOL;
+
+ logger('dba: ' . $str );