1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-10 16:14:57 +02:00

drivers: getResource() and getResultResource() checks if resource is alive

This commit is contained in:
David Grudl
2012-01-19 03:02:36 +01:00
parent c7b9a91fc2
commit 660a9db522
11 changed files with 30 additions and 28 deletions

View File

@@ -184,7 +184,7 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
*/
public function getResource()
{
return $this->connection;
return is_resource($this->connection) ? $this->connection : NULL;
}
@@ -314,7 +314,7 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
*/
public function __destruct()
{
$this->resultSet && @$this->free();
$this->getResultResource() && $this->free();
}
@@ -393,7 +393,7 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
*/
public function getResultResource()
{
return $this->resultSet;
return is_resource($this->resultSet) ? $this->resultSet : NULL;
}
}