Merge pull request #3830 from annando/dba-pdo-connected
DBA: The "connected" check for PDO didn't work.pull/3836/head
commit
404ed27fb4
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue