diff --git a/DatabasePdoPgsql.php b/DatabasePdoPgsql.php index 6c5b990..ce8fd86 100644 --- a/DatabasePdoPgsql.php +++ b/DatabasePdoPgsql.php @@ -3,7 +3,7 @@ /** * PDO/PostgreSQL wrapper with (mostly) DatabaseMySQL interface :) * Select builder is inspired by MediaWiki's one. - * Version: 2018-10-21 + * Version: 2018-11-04 * (c) Vitaliy Filippov, 2015-2018 */ @@ -789,6 +789,17 @@ class DatabasePdoPgsql implements Database * @param array $where Conditions for update query, see $this->where_builder(). */ function update($table, $set, $where = NULL, $options = NULL) + { + $sql = $this->update_builder($table, $set, $where, $options); + if (!$sql) + return false; + $r = $this->query($sql); + if ($r) + return $r->rowCount(); + return false; + } + + function update_builder($table, $set, $where = NULL, $options = NULL) { if (!$set) return false; @@ -808,10 +819,7 @@ class DatabasePdoPgsql implements Database $where = array_merge($where, $more); $where = $this->where_builder($where) ?: '1=1'; $sql .= ' WHERE ' . $where; - $r = $this->query($sql); - if ($r) - return $r->rowCount(); - return false; + return $sql; } /**