* @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);
}
* @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";
}
* @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;
* @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);
}
* @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";
}
* @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;
}
* @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;
$rs->close();
return false;
}
- return parent::get_record_sql($sql, $params, $mode);
+ return parent::get_record_sql($sql, $params, $strictness);
}
/**