From: skodak Date: Wed, 5 Nov 2008 00:05:41 +0000 (+0000) Subject: MDL-17020 pgsql: silenced php warnings X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ba98912f8ca13e2b99405d1bbfe33abcc796ac34;p=moodle.git MDL-17020 pgsql: silenced php warnings --- diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index f13fbce555..c88f9e5638 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -13,6 +13,8 @@ class pgsql_native_moodle_database extends moodle_database { protected $debug = false; protected $bytea_oid = null; + protected $last_debug; + /** * Detects if all needed PHP stuff installed. * Note: can be used before connect() @@ -147,6 +149,32 @@ class pgsql_native_moodle_database extends moodle_database { parent::dispose(); } + + /** + * Called before each db query. + * @param string $sql + * @param array array of parameters + * @param int $type type of query + * @param mixed $extrainfo driver specific extra information + * @return void + */ + protected function query_start($sql, array $params=null, $type, $extrainfo=null) { + parent::query_start($sql, $params, $type, $extrainfo); + // pgsql driver tents to send debug to output, we do not need that ;-) + $this->last_debug = error_reporting(0); + } + + /** + * Called immediately after each db query. + * @param mixed db specific result + * @return void + */ + protected function query_end($result) { + //reset original debug level + error_reporting($this->last_debug); + parent::query_end($result); + } + /** * Returns database server info array * @return array