mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-14679 removed all instances of get_fieldset_sql()
This commit is contained in:
parent
f36817104d
commit
f5c752f9b3
@ -460,3 +460,6 @@ function get_fieldset_select($table, $return, $select) {
|
||||
error('get_fieldset_select() removed');
|
||||
}
|
||||
|
||||
function get_fieldset_sql($sql) {
|
||||
error('get_fieldset_sql() removed');
|
||||
}
|
||||
|
@ -662,55 +662,6 @@ function get_field_sql($sql) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of data from one or more fields from a database
|
||||
* use to get a column, or a series of distinct values
|
||||
*
|
||||
* @uses $CFG
|
||||
* @uses $db
|
||||
* @param string $sql The SQL string you wish to be executed.
|
||||
* @return mixed|false Returns the value return from the SQL statment or false if an error occured.
|
||||
* @todo Finish documenting this function
|
||||
*/
|
||||
function get_fieldset_sql($sql) {
|
||||
|
||||
global $db, $CFG;
|
||||
|
||||
if (defined('MDL_PERFDB')) { global $PERF ; $PERF->dbqueries++; };
|
||||
|
||||
$rs = $db->Execute($sql);
|
||||
if (!$rs) {
|
||||
debugging($db->ErrorMsg() .'<br /><br />'. s($sql));
|
||||
if (!empty($CFG->dblogerror)) {
|
||||
$debug=array_shift(debug_backtrace());
|
||||
error_log("SQL ".$db->ErrorMsg()." in {$debug['file']} on line {$debug['line']}. STATEMENT: $sql");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !rs_EOF($rs) ) {
|
||||
$keys = array_keys($rs->fields);
|
||||
$key0 = $keys[0];
|
||||
$results = array();
|
||||
while (!$rs->EOF) {
|
||||
array_push($results, $rs->fields[$key0]);
|
||||
$rs->MoveNext();
|
||||
}
|
||||
/// DIRTY HACK to retrieve all the ' ' (1 space) fields converted back
|
||||
/// to '' (empty string) for Oracle. It's the only way to work with
|
||||
/// all those NOT NULL DEFAULT '' fields until we definetively delete them
|
||||
if ($CFG->dbfamily == 'oracle') {
|
||||
array_walk($results, 'onespace2empty');
|
||||
}
|
||||
/// End of DIRTY HACK
|
||||
rs_close($rs);
|
||||
return $results;
|
||||
} else {
|
||||
rs_close($rs);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete one or more records from a table
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user