From 1cbe27de12dc15b6b6a6cc8815e3b35709d37d1f Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 29 Oct 2017 06:31:01 +0000 Subject: [PATCH] DBA: The "connected" check for PDO didn't work. --- include/dba.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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(); -- 2.39.5