From: yoonghm Date: Sun, 27 Sep 2015 05:56:29 +0000 (+0800) Subject: Clear previously left-over PQresult before calling pg_get_result() X-Git-Tag: 1.31.0-rc.0~9446^2 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=a6ed7422370eb315564fadb7be59b6969baa796e;p=lhc%2Fweb%2Fwiklou.git Clear previously left-over PQresult before calling pg_get_result() Bug: T52091 Change-Id: Iaa1a479b5eefcae0fc8f82b1d20e9575d609c0e9 --- diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index c9d7b35c53..64ae1c6c61 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -395,6 +395,9 @@ class DatabasePostgres extends Database { if ( function_exists( 'mb_convert_encoding' ) ) { $sql = mb_convert_encoding( $sql, 'UTF-8' ); } + // Clear previously left over PQresult + while ( $res = pg_get_result( $this->mConn ) ) + pg_free_result( $res ); if ( pg_send_query( $this->mConn, $sql ) === false ) { throw new DBUnexpectedError( $this, "Unable to post new query to PostgreSQL\n" ); }