]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17020 pgsql: silenced php warnings
authorskodak <skodak>
Wed, 5 Nov 2008 00:05:41 +0000 (00:05 +0000)
committerskodak <skodak>
Wed, 5 Nov 2008 00:05:41 +0000 (00:05 +0000)
lib/dml/pgsql_native_moodle_database.php

index f13fbce555fede81cd5f9ed834b6b7c18496ec57..c88f9e563810557b4cd5362f09a962d8ccfcf3e8 100644 (file)
@@ -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