MDL-19689 fixed strictness constants, thanks Tim

This commit is contained in:
skodak 2009-07-04 10:53:57 +00:00
parent 98c8594a76
commit 2bad34a309
2 changed files with 10 additions and 10 deletions

View 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;
}

View 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);
}
/**