]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19689 fixed strictness constants, thanks Tim
authorskodak <skodak>
Sat, 4 Jul 2009 10:53:57 +0000 (10:53 +0000)
committerskodak <skodak>
Sat, 4 Jul 2009 10:53:57 +0000 (10:53 +0000)
lib/dml/moodle_database.php
lib/dml/oci_native_moodle_database.php

index cc6998bfa75f0c005e92f36acda7e29a65db6f76..a77598e2d3d774039cde19a3475b1fb9078ccf81 100644 (file)
@@ -1134,7 +1134,7 @@ abstract class moodle_database {
      * @return mixed a fieldset object containing the first matching record, false or exception if error not found depending on mode
      * @throws dml_exception if error
      */
-    public function get_record($table, array $conditions, $fields='*', $strictness=0) {
+    public function get_record($table, array $conditions, $fields='*', $strictness=IGNORE_MISSING) {
         list($select, $params) = $this->where_clause($conditions);
         return $this->get_record_select($table, $select, $params, $fields, $strictness);
     }
@@ -1151,7 +1151,7 @@ abstract class moodle_database {
      * @return mixed a fieldset object containing the first matching record, false or exception if error not found depending on mode
      * @throws dml_exception if error
      */
-    public function get_record_select($table, $select, array $params=null, $fields='*', $strictness=0) {
+    public function get_record_select($table, $select, array $params=null, $fields='*', $strictness=IGNORE_MISSING) {
         if ($select) {
             $select = "WHERE $select";
         }
@@ -1177,7 +1177,7 @@ abstract class moodle_database {
      * @return mixed a fieldset object containing the first matching record, false or exception if error not found depending on mode
      * @throws dml_exception if error
      */
-    public function get_record_sql($sql, array $params=null, $strictness=0) {
+    public function get_record_sql($sql, array $params=null, $strictness=IGNORE_MISSING) {
         $strictness = (int)$strictness; // we support true/false for BC reasons too
         if ($strictness == IGNORE_MULTIPLE) {
             $count = 1;
@@ -1215,7 +1215,7 @@ abstract class moodle_database {
      * @return mixed the specified value false if not found
      * @throws dml_exception if error
      */
-    public function get_field($table, $return, array $conditions, $strictness=0) {
+    public function get_field($table, $return, array $conditions, $strictness=IGNORE_MISSING) {
         list($select, $params) = $this->where_clause($conditions);
         return $this->get_field_select($table, $return, $select, $params, $strictness);
     }
@@ -1233,7 +1233,7 @@ abstract class moodle_database {
      * @return mixed the specified value false if not found
      * @throws dml_exception if error
      */
-    public function get_field_select($table, $return, $select, array $params=null, $strictness=0) {
+    public function get_field_select($table, $return, $select, array $params=null, $strictness=IGNORE_MISSING) {
         if ($select) {
             $select = "WHERE $select";
         }
@@ -1258,7 +1258,7 @@ abstract class moodle_database {
      * @return mixed the specified value false if not found
      * @throws dml_exception if error
      */
-    public function get_field_sql($sql, array $params=null, $strictness=0) {
+    public function get_field_sql($sql, array $params=null, $strictness=IGNORE_MISSING) {
         if (!$record = $this->get_record_sql($sql, $params, $strictness)) {
             return false;
         }
index 317110d95536ace21908ab37e14d896e74ae0740..432f74852596b3711c32a911ed03e0721efbfaf6 100644 (file)
@@ -667,9 +667,9 @@ class oci_native_moodle_database extends moodle_database {
      * @return mixed a fieldset object containing the first matching record, false or exception if error not found depending on mode
      * @throws dml_exception if error
      */
-    public function get_record_sql($sql, array $params=null, $mode=0) {
-        $mode = (int)$mode;
-        if ($mode == IGNORE_MULTIPLE) {
+    public function get_record_sql($sql, array $params=null, $strictness=IGNORE_MISSING) {
+        $strictness = (int)$strictness;
+        if ($strictness == IGNORE_MULTIPLE) {
             // do not limit here - ORA does not like that
             if (!$rs = $this->get_recordset_sql($sql, $params)) {
                 return false;
@@ -681,7 +681,7 @@ class oci_native_moodle_database extends moodle_database {
             $rs->close();
             return false;
         }
-        return parent::get_record_sql($sql, $params, $mode);
+        return parent::get_record_sql($sql, $params, $strictness);
     }
 
     /**