]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20734 normalise_value() - moving from private to protected everywhere and abstracting
authorEloy Lafuente <stronk7@moodle.org>
Wed, 4 Nov 2009 13:19:11 +0000 (13:19 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Wed, 4 Nov 2009 13:19:11 +0000 (13:19 +0000)
lib/dml/moodle_database.php
lib/dml/mssql_native_moodle_database.php
lib/dml/mysqli_native_moodle_database.php
lib/dml/oci_native_moodle_database.php
lib/dml/pgsql_native_moodle_database.php
lib/dml/simpletest/testdml.php
lib/dml/sqlite3_pdo_moodle_database.php

index cf303a51818168b3048a7999fc1d323214ebeaee..4dff70cb424ee10aecc4328b883cee3d1ee4dcfe 100644 (file)
@@ -744,6 +744,15 @@ abstract class moodle_database {
      */
     public abstract function get_columns($table, $usecache=true);
 
+    /**
+     * Normalise values based in RDBMS dependencies (booleans, LOBs...)
+     *
+     * @param database_column_info $column column metadata corresponding with the value we are going to normalise
+     * @param mixed $value value we are going to normalise
+     * @return mixed the normalised value
+     */
+    protected abstract function normalise_value($column, $value);
+
     /**
      * Reset internal column details cache
      * @param string $table - empty means all, or one if name of table given
index db2f0ba1b30bac9d1bc6697a6118d2491c163940..07398f53c7b15e325c4a6c51e1ce81b55eacd846 100644 (file)
@@ -517,7 +517,7 @@ class mssql_native_moodle_database extends moodle_database {
      * @param mixed $value value we are going to normalise
      * @return mixed the normalised value
      */
-    private function normalise_value($column, $value) {
+    protected function normalise_value($column, $value) {
         if (is_bool($value)) { /// Always, convert boolean to int
             $value = (int)$value;
         } // And continue processing because text columns with numeric info need special handling below
index 05ff0548293e01f116d53437f883f37048cc657d..2ba86cd90eb9bacac48a908843b3ae4faa3f7d4e 100644 (file)
@@ -462,7 +462,7 @@ class mysqli_native_moodle_database extends moodle_database {
      * @param mixed $value value we are going to normalise
      * @return mixed the normalised value
      */
-    private function normalise_value($column, $value) {
+    protected function normalise_value($column, $value) {
         if (is_bool($value)) { // Always, convert boolean to int
             $value = (int)$value;
 
index b89b1cacb43060d14b6e3f3b8bbf81ef498c4c10..16b3a4203758ece2074305555129b080a3318bb8 100644 (file)
@@ -638,7 +638,7 @@ class oci_native_moodle_database extends moodle_database {
      * @param mixed $value value we are going to normalise
      * @return mixed the normalised value
      */
-    private function normalise_value($column, $value) {
+    protected function normalise_value($column, $value) {
         if (is_bool($value)) { // Always, convert boolean to int
             $value = (int)$value;
 
index d2be127c9878abd82675885a3a5600d9379030f8..6e9836f41cb14a23f5604eb2621f72fb68b9efe6 100644 (file)
@@ -508,7 +508,7 @@ class pgsql_native_moodle_database extends moodle_database {
      * @param mixed $value value we are going to normalise
      * @return mixed the normalised value
      */
-    private function normalise_value($column, $value) {
+    protected function normalise_value($column, $value) {
         if (is_bool($value)) { // Always, convert boolean to int
             $value = (int)$value;
 
index 6c5b37b4d1417eb6819330ab0b327d973870e993..56a90c9b986a7920f63bc4778eb70ddce746572b 100755 (executable)
@@ -2435,6 +2435,7 @@ class moodle_database_for_testing extends moodle_database {
     public function get_tables($usecache=true){}
     public function get_indexes($table){}
     public function get_columns($table, $usecache=true){}
+    protected function normalise_value($column, $value){}
     public function set_debug($state){}
     public function get_debug(){}
     public function set_logging($state){}
index e3821cc723cfaf82f4bdc103d365dade77642f65..30b44f8ddd98e572bfa079854af85b9b3cd62364 100644 (file)
@@ -293,6 +293,17 @@ class sqlite3_pdo_moodle_database extends pdo_moodle_database {
         return $columns;
     }
 
+    /**
+     * Normalise values based in RDBMS dependencies (booleans, LOBs...)
+     *
+     * @param database_column_info $column column metadata corresponding with the value we are going to normalise
+     * @param mixed $value value we are going to normalise
+     * @return mixed the normalised value
+     */
+    protected function normalise_value($column, $value) {
+        return $value;
+    }
+
     /**
      * Returns the sql statement with clauses to append used to limit a recordset range.
      * @param string $sql the SQL statement to limit.