From: Michael Date: Sun, 29 Oct 2017 06:31:01 +0000 (+0000) Subject: DBA: The "connected" check for PDO didn't work. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1cbe27de12dc15b6b6a6cc8815e3b35709d37d1f;p=friendica.git DBA: The "connected" check for PDO didn't work. --- diff --git a/include/dba.php b/include/dba.php index 42f0614c80..74e9d7c061 100644 --- a/include/dba.php +++ b/include/dba.php @@ -222,10 +222,15 @@ class dba { } public static function connected() { + $connected = false; + switch (self::$driver) { case 'pdo': - // Not sure if this really is working like expected - $connected = (self::$db->getAttribute(PDO::ATTR_CONNECTION_STATUS) != ""); + $r = dba::p("SELECT 1"); + if (dbm::is_result($r)) { + $row = dba::inArray($r); + $connected = ($row[0]['1'] == '1'); + } break; case 'mysqli': $connected = self::$db->ping();