From 0ff0cd21dfc9f18510f4944f1569d51cc9b6c9eb Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 28 Aug 2007 21:41:15 +0000 Subject: [PATCH] * fixed pg_affected_rows --- dibi/drivers/postgre.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dibi/drivers/postgre.php b/dibi/drivers/postgre.php index af666c30..ef9a3640 100644 --- a/dibi/drivers/postgre.php +++ b/dibi/drivers/postgre.php @@ -85,19 +85,20 @@ class DibiPostgreDriver extends DibiDriver { $this->affectedRows = FALSE; - $connection = $this->getConnection(); - $res = @pg_query($connection, $sql); + $res = @pg_query($this->getConnection(), $sql); - if ($res === FALSE) return FALSE; + if ($res === FALSE) { + return FALSE; - $this->affectedRows = pg_affected_rows($connection); - if ($this->affectedRows < 0) $this->affectedRows = FALSE; + } elseif (is_resource($res)) { + $this->affectedRows = pg_affected_rows($res); + if ($this->affectedRows < 0) $this->affectedRows = FALSE; - if (is_resource($res)) { return new DibiPostgreResult($res); - } - return TRUE; + } else { + return TRUE; + } }