diff options
author | Michael Vogel <icarus@dabo.de> | 2012-04-13 00:05:52 +0200 |
---|---|---|
committer | Michael Vogel <icarus@dabo.de> | 2012-04-13 00:05:52 +0200 |
commit | 138caa4380c442200964c8cf071438a0be89da70 (patch) | |
tree | 395be76cd94664f802042f428081a6ffbec33414 /include | |
parent | ee714daf4d33f8258e1301438423fc10a3bdc916 (diff) | |
download | volse-hubzilla-138caa4380c442200964c8cf071438a0be89da70.tar.gz volse-hubzilla-138caa4380c442200964c8cf071438a0be89da70.tar.bz2 volse-hubzilla-138caa4380c442200964c8cf071438a0be89da70.zip |
DBA: Deactivation of the mysqli-class for testing purposes.
Diffstat (limited to 'include')
-rw-r--r-- | include/dba.php | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/include/dba.php b/include/dba.php index 1421a703d..9031f44cf 100644 --- a/include/dba.php +++ b/include/dba.php @@ -53,8 +53,9 @@ if(! class_exists('dba')) { } if(class_exists('mysqli')) { - $this->db = new mysqli($server,$user,$pass,$db); - if(NULL === $this->db->connect_error) { + $this->db = @new mysqli($server,$user,$pass,$db); + //if(NULL === $this->db->connect_error) { + if(!$this->db->connect_error) { $this->connected = true; } else { throw new RuntimeException($this->db->connect_error); @@ -116,7 +117,7 @@ if(! class_exists('dba')) { // If dbfail.out exists, we will write any failed calls directly to it, // regardless of any logging that may or may nor be in effect. // These usually indicate SQL syntax errors that need to be resolved. - if(file_exists('dbfail.out')) {
+ if(file_exists('dbfail.out')) { file_put_contents('dbfail.out', datetime_convert() . "\n" . $str . "\n", FILE_APPEND); } logger('dba: ' . $str ); @@ -176,49 +177,49 @@ if(! class_exists('dba')) { * commit() or rollback(). Please mind that the db table engine may * not support this. */ - public function beginTransaction() {
- if($this->mysqli) {
- return $this->db->autocommit(false);
- } else {
+ public function beginTransaction() { + if($this->mysqli) { + return $this->db->autocommit(false); + } else { //no transaction support in mysql module... - mysql_query('SET AUTOCOMMIT = 0;', $db);
- }
+ mysql_query('SET AUTOCOMMIT = 0;', $db); + } } /** * rollback a transaction. So, rollback anything that was done since the last call * to beginTransaction(). */ - public function rollback() {
- if($this->mysqli) {
- return $this->db->rollback();
- } else {
+ public function rollback() { + if($this->mysqli) { + return $this->db->rollback(); + } else { //no transaction support in mysql module... - mysql_query('ROLLBACK;', $db);
+ mysql_query('ROLLBACK;', $db); } - $this->stopTransaction();
+ $this->stopTransaction(); } /** * commit a transaction. So, write any query to the database. */ - public function commit() {
- if($this->mysqli) {
- return $this->db->commit();
- } else {
- //no transaction support in mysql module...
- mysql_query('COMMIT;', $db);
- }
- $this->stopTransaction();
+ public function commit() { + if($this->mysqli) { + return $this->db->commit(); + } else { + //no transaction support in mysql module... + mysql_query('COMMIT;', $db); + } + $this->stopTransaction(); } - private function stopTransaction() {
- if($this->mysqli) {
- return $this->db->autocommit(true);
- } else {
- //no transaction support in mysql module...
- mysql_query('SET AUTOCOMMIT = 1;', $db);
- }
+ private function stopTransaction() { + if($this->mysqli) { + return $this->db->autocommit(true); + } else { + //no transaction support in mysql module... + mysql_query('SET AUTOCOMMIT = 1;', $db); + } } public function dbg($dbg) { |