]> git.mxchange.org Git - friendica.git/commitdiff
Reenabled PDO engine.
authorMichael Vogel <icarus@dabo.de>
Fri, 9 May 2014 18:43:06 +0000 (20:43 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 9 May 2014 18:43:06 +0000 (20:43 +0200)
include/dba.php
include/dba_pdo.php

index 760bac10cefe5228a30ab6f0595e860866050f21..7409ec3a8ce69e278e9ac0c205dc7890b5e9657e 100644 (file)
@@ -1,9 +1,10 @@
 <?php
-// Temporarily removed
-//if(class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
-//  require_once("library/dddbl2/dddbl.php");
-//  require_once("include/dba_pdo.php");
-//}
+
+# if PDO is avaible for mysql, use the new database abstraction
+if(class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
+  require_once("library/dddbl2/dddbl.php");
+  require_once("include/dba_pdo.php");
+}
 
 require_once('include/datetime.php');
 
index 76937e7f95e1b98e32f02f14fdf7474331920838..2f1309b9a2bea565a18b1cc28ae592faf3f7105a 100644 (file)
@@ -189,9 +189,10 @@ class dba {
 
                if(($result === true) || ($result === false))
                        return $result;
-
+    
                if ($onlyquery) {
-                       $this->result = $result;
+                       $this->result = $r;       # this will store an PDOStatement Object in result
+      $this->result->execute(); # execute the Statement, to get its result
                        return true;
                }
     
@@ -203,17 +204,17 @@ class dba {
        }
 
        public function qfetch() {
-  
-               if (!$this->result)
+
+               if (false === $this->result)
       return false;
-      
+
     return $this->result->fetch();
 
        }
   
        public function qclose() {
                if ($this->result)
-      $this->result->closeCursor();
+      return $this->result->closeCursor();
        }
 
        public function dbg($dbg) {
@@ -337,4 +338,3 @@ if(! function_exists('dba_timer')) {
 function dba_timer() {
   return microtime(true);
 }}
-