]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14990 dml: towards proper logging/perf infrastructure
authorskodak <skodak>
Tue, 28 Oct 2008 22:31:26 +0000 (22:31 +0000)
committerskodak <skodak>
Tue, 28 Oct 2008 22:31:26 +0000 (22:31 +0000)
lib/dml/moodle_database.php

index 6cea81570bcaae1a23d2b0048dcc42be5123ec67..b1dfe102f3c28083acb06e5f6c8e26f6973d3b88 100644 (file)
@@ -5,21 +5,31 @@ require_once($CFG->libdir.'/dml/moodle_recordset.php');
 
 /// GLOBAL CONSTANTS /////////////////////////////////////////////////////////
 
-/**
- * Bitmask, indicates only :name type parameters are supported by db backend.
- */
+/** Bitmask, indicates :name type parameters are supported by db backend. */
 define('SQL_PARAMS_NAMED', 1);
 
-/**
- * Bitmask, indicates only ? type parameters are supported by db backend.
- */
+/** Bitmask, indicates ? type parameters are supported by db backend. */
 define('SQL_PARAMS_QM', 2);
 
-/**
- * Bitmask, indicates only $1, $2.. type parameters are supported by db backend.
- */
+/** Bitmask, indicates $1, $2, ... type parameters are supported by db backend. */
 define('SQL_PARAMS_DOLLAR', 4);
 
+
+/** Normal select query, reading only */
+define('SQL_QUERY_SELECT', 1);
+
+/** Insert select query, writing */
+define('SQL_QUERY_INSERT', 2);
+
+/** Update select query, writing */
+define('SQL_QUERY_UPDATE', 3);
+
+/** Query changing db structure, writing */
+define('SQL_QUERY_STRUCTURE', 4);
+
+/** Auxiliary query done by driver, setting connection config, getting table info, etc. */
+define('SQL_QUERY_AUX', 5);
+
 /**
  * Abstract class representing moodle database interface.
  * @package dml
@@ -228,6 +238,26 @@ abstract class moodle_database {
         $this->columns = array();
     }
 
+    /**
+     * Called before each db query.
+     * @param string $sql
+     * @param array array of parameters
+     * @param int $type type of query
+     * @return void
+     */
+    public function query_start($sql, $params, $type) {
+        //TODO
+    }
+
+    /**
+     * Called immediately after each db query.
+     * @param mixed db specific result
+     * @return void
+     */
+    public function query_end($result) {
+        //TODO
+    }
+
     /**
      * Returns database server info array
      * @return array