1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-11 08:34:59 +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

@@ -252,7 +252,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
*/
public function getResource()
{
return $this->connection;
return @$this->connection->thread_id ? $this->connection : NULL;
}
@@ -380,7 +380,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
*/
public function __destruct()
{
$this->resultSet && @$this->free();
$this->getResultResource() && $this->free();
}
@@ -479,7 +479,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
*/
public function getResultResource()
{
return $this->resultSet;
return @$this->resultSet->type === NULL ? NULL : $this->resultSet;
}
}