Short-circuit true if insert has no rows.
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Fri, 2 May 2008 15:28:10 +0000 (15:28 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Fri, 2 May 2008 15:28:10 +0000 (15:28 +0000)
includes/DatabasePostgres.php

index c5a1b91..125ad75 100644 (file)
@@ -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} ":"");
        }