From 350e828152cb3bd0989ada00be1458008353f989 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Fri, 2 May 2008 15:28:10 +0000 Subject: [PATCH] Short-circuit true if insert has no rows. --- includes/DatabasePostgres.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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} ":""); } -- 2.20.1