mirror of
https://github.com/dg/dibi.git
synced 2025-08-29 16:59:49 +02:00
- DibiPostgreDriver - workaround for bug in pg_affected_rows
- added DibiResult::setObjects([TRUE | FALSE | class name])
This commit is contained in:
@@ -58,6 +58,13 @@ class DibiPostgreDriver extends /*Nette::*/Object implements IDibiDriver
|
||||
private $escMethod = FALSE;
|
||||
|
||||
|
||||
/**
|
||||
* Affected rows.
|
||||
* @var int|FALSE
|
||||
*/
|
||||
private $affectedRows = FALSE;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @throws DibiException
|
||||
@@ -144,9 +151,12 @@ class DibiPostgreDriver extends /*Nette::*/Object implements IDibiDriver
|
||||
$this->resultset = @pg_query($this->connection, $sql);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -159,7 +169,7 @@ class DibiPostgreDriver extends /*Nette::*/Object implements IDibiDriver
|
||||
*/
|
||||
public function affectedRows()
|
||||
{
|
||||
return pg_affected_rows($this->resultset);
|
||||
return $this->affectedRows;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user