]> git.mxchange.org Git - friendica.git/blobdiff - include/dba.php
DBA: Deactivation of the mysqli-class for testing purposes.
[friendica.git] / include / dba.php
index 1421a703dc730ad1a7eb803e30c632ff0d17937c..9031f44cfa3efc16ed96f6f4d574d4b0be29b734 100644 (file)
@@ -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')) {\r
+                               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() {\r
-                       if($this->mysqli) {\r
-                               return $this->db->autocommit(false);\r
-                       } else {\r
+               public function beginTransaction() {
+                       if($this->mysqli) {
+                               return $this->db->autocommit(false);
+                       } else {
                                //no transaction support in mysql module...
-                               mysql_query('SET AUTOCOMMIT = 0;', $db); \r
-                       }\r
+                               mysql_query('SET AUTOCOMMIT = 0;', $db); 
+                       }
                }
                
                /**
                 * 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
+               public function rollback() {
+                       if($this->mysqli) {
+                               return $this->db->rollback();
+                       } else {
                                //no transaction support in mysql module...
-                               mysql_query('ROLLBACK;', $db);\r
+                               mysql_query('ROLLBACK;', $db);
                        }
-                       $this->stopTransaction(); \r
+                       $this->stopTransaction(); 
                }
 
                /**
                 * commit a transaction. So, write any query to the database. 
                 */
-               public function commit() {\r
-                       if($this->mysqli) {\r
-                               return $this->db->commit();\r
-                       } else {\r
-                               //no transaction support in mysql module...\r
-                               mysql_query('COMMIT;', $db);\r
-                       }\r
-                       $this->stopTransaction();\r
+               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() {\r
-                       if($this->mysqli) {\r
-                               return $this->db->autocommit(true);\r
-                       } else {\r
-                               //no transaction support in mysql module...\r
-                               mysql_query('SET AUTOCOMMIT = 1;', $db);\r
-                       }\r
+               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) {