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; + } }