fix sql_substr() behaviour
authorstronk7 <stronk7>
Tue, 25 Aug 2009 20:39:00 +0000 (20:39 +0000)
committerstronk7 <stronk7>
Tue, 25 Aug 2009 20:39:00 +0000 (20:39 +0000)
lib/dml/mssql_adodb_moodle_database.php

index fc36344871a2911b09b69c069288561846f1e988..666348ace0fb1b5a8be3a3922d61166eeb6f88f5 100644 (file)
@@ -193,6 +193,9 @@ class mssql_adodb_moodle_database extends adodb_moodle_database {
      * @return string sql fragment
      */
     public function sql_substr($expr, $start, $length=false) {
+        if (count(func_get_args()) < 2) {
+            throw new coding_exception('moodle_database::sql_substr() requires at least two parameters', 'Originaly this function was only returning name of SQL substring function, it now requires all parameters.');
+        }
         if ($length === false) {
             return "SUBSTRING($expr, $start, (LEN($expr) - $start + 1))";
         } else {