]> git.mxchange.org Git - friendica.git/blobdiff - include/dba.php
Issue 3326: We are now completely working with utf8mb4
[friendica.git] / include / dba.php
index 7a1e3a25975ade6f09cd7dfa5f2675635aed7db7..62728acaed0294ba467cb126cd5ed022f1329e95 100644 (file)
@@ -218,21 +218,7 @@ class dba {
 
                $this->error = '';
 
-               // Check the connection (This can reconnect the connection - if configured)
-               switch ($this->driver) {
-                       case 'pdo':
-                               // Not sure if this really is working like expected
-                               $connected = ($this->db->getAttribute(PDO::ATTR_CONNECTION_STATUS) != "");
-                               break;
-                       case 'mysqli':
-                               $connected = $this->db->ping();
-                               break;
-                       case 'mysql':
-                               $connected = mysql_ping($this->db);
-                               break;
-               }
-
-               $connstr = ($connected ? "Connected" : "Disonnected");
+               $connstr = ($this->connected() ? "Connected" : "Disonnected");
 
                $stamp1 = microtime(true);
 
@@ -248,7 +234,9 @@ class dba {
                        case 'pdo':
                                $result = @$this->db->query($sql);
                                // Is used to separate between queries that returning data - or not
-                               $columns = $result->columnCount();
+                               if (!is_bool($result)) {
+                                       $columns = $result->columnCount();
+                               }
                                break;
                        case 'mysqli':
                                $result = @$this->db->query($sql);
@@ -343,7 +331,7 @@ class dba {
                        }
                }
 
-               if (($result === true) || ($result === false)) {
+               if (is_bool($result)) {
                        return $result;
                }
                if ($onlyquery) {