From 2bad34a3099a486f69737b9a7891c70ce8b89346 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 4 Jul 2009 10:53:57 +0000 Subject: [PATCH] MDL-19689 fixed strictness constants, thanks Tim --- lib/dml/moodle_database.php | 12 ++++++------ lib/dml/oci_native_moodle_database.php | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index cc6998bfa7..a77598e2d3 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -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; } diff --git a/lib/dml/oci_native_moodle_database.php b/lib/dml/oci_native_moodle_database.php index 317110d955..432f748525 100644 --- a/lib/dml/oci_native_moodle_database.php +++ b/lib/dml/oci_native_moodle_database.php @@ -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); } /** -- 2.39.5