From: Greg Sabino Mullane Date: Fri, 2 May 2008 15:28:10 +0000 (+0000) Subject: Short-circuit true if insert has no rows. X-Git-Tag: 1.31.0-rc.0~47949 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=350e828152cb3bd0989ada00be1458008353f989;p=lhc%2Fweb%2Fwiklou.git Short-circuit true if insert has no rows. --- diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index c5a1b91e7f..125ad75101 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -721,6 +721,10 @@ class DatabasePostgres extends Database { function insert( $table, $args, $fname = 'DatabasePostgres::insert', $options = array() ) { global $wgDBversion; + if ( !count( $args ) ) { + return true; + } + $table = $this->tableName( $table ); if (! isset( $wgDBversion ) ) { $this->getServerVersion(); @@ -924,7 +928,7 @@ class DatabasePostgres extends Database { return ''; } - function limitResult($sql, $limit,$offset=false) { + function limitResult($sql, $limit, $offset=false) { return "$sql LIMIT $limit ".(is_numeric($offset)?" OFFSET {$offset} ":""); }