Merge pull request #7428 from burriko/fix-dbo-connection-issues

Fix use of $_connection in DboSource in 2.x
This commit is contained in:
Mark Story 2015-09-21 21:38:20 -04:00
commit 9208a0857e

View file

@ -284,7 +284,7 @@ class DboSource extends DataSource {
if ($this->_result instanceof PDOStatement) {
$this->_result->closeCursor();
}
unset($this->_connection);
$this->_connection = null;
$this->connected = false;
return true;
}
@ -857,11 +857,15 @@ class DboSource extends DataSource {
* @return bool True if the database is connected, else false
*/
public function isConnected() {
if ($this->_connection === null) {
$connected = false;
} else {
try {
$connected = $this->_connection->query('SELECT 1');
} catch (Exception $e) {
$connected = false;
}
}
$this->connected = !empty($connected);
return $this->connected;
}