1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-31 09:41:43 +02:00

- removed DibiPostgreDriver workaround (there is no bug in pg_affected_rows)

- added IDibiConnection::isConnected()
This commit is contained in:
David Grudl
2008-05-16 17:56:24 +00:00
parent b27b0193f1
commit a8acce6d59
13 changed files with 60 additions and 49 deletions

View File

@@ -58,13 +58,6 @@ class DibiPostgreDriver extends /*Nette::*/Object implements IDibiDriver
private $escMethod = FALSE;
/**
* Affected rows.
* @var int|FALSE
*/
private $affectedRows = FALSE;
/**
* @throws DibiException
@@ -148,16 +141,13 @@ class DibiPostgreDriver extends /*Nette::*/Object implements IDibiDriver
*/
public function query($sql)
{
$this->resultset = @pg_query($this->connection, $sql);
$this->resultset = @pg_query($this->connection, $sql); // intentionally @
if ($this->resultset === FALSE) {
$this->affectedRows = FALSE;
throw new DibiDriverException(pg_last_error($this->connection), 0, $sql);
}
$this->affectedRows = pg_affected_rows($this->resultset); // retrieve immediately due PHP bug
return is_resource($this->resultset);
return is_resource($this->resultset) && pg_num_fields($this->resultset);
}
@@ -169,7 +159,7 @@ class DibiPostgreDriver extends /*Nette::*/Object implements IDibiDriver
*/
public function affectedRows()
{
return $this->affectedRows;
return pg_affected_rows($this->resultset);
}