MDL-14679 converted some sql_'s

This commit is contained in:
skodak 2008-06-02 21:56:06 +00:00
parent 8618fd2aeb
commit 7e60297f54
9 changed files with 15 additions and 13 deletions

View File

@ -40,7 +40,7 @@ if ($confirm and confirm_sesskey()) {
} else {
$in = implode(',', $SESSION->bulk_users);
$userlist = $DB->get_records_select_menu('user', "id IN ($in)", null, 'fullname', 'id,'.sql_fullname().' AS fullname');
$userlist = $DB->get_records_select_menu('user', "id IN ($in)", null, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
$usernames = implode(', ', $userlist);
$optionsyes = array();
$optionsyes['confirm'] = 1;

View File

@ -39,7 +39,7 @@ if ($confirm and confirm_sesskey()) {
} else {
$in = implode(',', $SESSION->bulk_users);
$userlist = $DB->get_records_select_menu('user', "id IN ($in)", null, 'fullname', 'id,'.sql_fullname().' AS fullname');
$userlist = $DB->get_records_select_menu('user', "id IN ($in)", null, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
$usernames = implode(', ', $userlist);
$optionsyes = array();
$optionsyes['confirm'] = 1;

View File

@ -730,7 +730,7 @@ function print_log_ods($course, $user, $date, $order='l.time DESC', $modname,
}
if ($ld && !empty($log->info)) {
// ugly hack to make sure fullname is shown correctly
if (($ld->mtable == 'user') and ($ld->field == sql_concat('firstname', "' '" , 'lastname'))) {
if (($ld->mtable == 'user') and ($ld->field == $DB->sql_concat('firstname', "' '" , 'lastname'))) {
$log->info = fullname($DB->get_record($ld->mtable, array('id'=>$log->info)), true);
} else {
$log->info = $DB->get_field($ld->mtable, $ld->field, array('id'=>$log->info));

View File

@ -444,9 +444,9 @@ function search_generate_text_SQL($parsetree, $datafield, $metafield, $mainidfie
function search_generate_SQL($parsetree, $datafield, $metafield, $mainidfield, $useridfield,
$userfirstnamefield, $userlastnamefield, $timefield, $instancefield) {
global $CFG;
global $CFG, $DB;
$LIKE = sql_ilike();
$LIKE = $DB->sql_ilike();
$NOTLIKE = 'NOT ' . $LIKE;
if ($CFG->dbfamily == "postgres") {
$REGEXP = "~*";

View File

@ -488,11 +488,12 @@ class flexible_table {
* @return type?
*/
function get_sql_where() {
global $DB;
if(!isset($this->columns['fullname'])) {
return '';
}
$LIKE = sql_ilike();
$LIKE = $DB->sql_ilike();
if(!empty($this->sess->i_first) && !empty($this->sess->i_last)) {
return 'firstname '.$LIKE.' \''.$this->sess->i_first.'%\' AND lastname '.$LIKE.' \''.$this->sess->i_last.'%\'';
}

View File

@ -81,7 +81,7 @@ class user_filter_courserole extends user_filter_type {
* @return array sql string and $params
*/
function get_sql_filter($data) {
global $CFG;
global $CFG, $DB;
static $counter = 0;
$name = 'ex_courserole'.$counter++;
@ -104,7 +104,7 @@ class user_filter_courserole extends user_filter_type {
$where .= " AND c.category=$categoryid";
}
if ($value) {
$where .= " AND c.shortname ".sql_ilike()." :$name";
$where .= " AND c.shortname ".$DB->sql_ilike()." :$name";
$params[$name] = $value;
}
return array("id IN (SELECT userid

View File

@ -94,11 +94,11 @@ class user_filtering {
* @return object filter
*/
function get_field($fieldname, $advanced) {
global $USER;
global $USER, $DB;
switch ($fieldname) {
case 'username': return new user_filter_text('username', get_string('username'), $advanced, 'username');
case 'realname': return new user_filter_text('realname', get_string('fullnameuser'), $advanced, sql_fullname());
case 'realname': return new user_filter_text('realname', get_string('fullnameuser'), $advanced, $DB->sql_fullname());
case 'lastname': return new user_filter_text('lastname', get_string('lastname'), $advanced, 'lastname');
case 'firstname': return new user_filter_text('firstname', get_string('firstname'), $advanced, 'firstname');
case 'email': return new user_filter_text('email', get_string('email'), $advanced, 'email');

View File

@ -101,7 +101,7 @@ class user_filter_profilefield extends user_filter_type {
* @return array sql string and $params
*/
function get_sql_filter($data) {
global $CFG;
global $CFG, $DB;
static $counter = 0;
$name = 'ex_profilefield'.$counter++;
@ -121,7 +121,7 @@ class user_filter_profilefield extends user_filter_type {
$where = "";
$op = " IN ";
$ilike = sql_ilike();
$ilike = $DB->sql_ilike();
if ($operator < 5 and $value === '') {
return '';

View File

@ -75,6 +75,7 @@ class user_filter_text extends user_filter_type {
* @return array sql string and $params
*/
function get_sql_filter($data) {
global $DB;
static $counter = 0;
$name = 'ex_text'.$counter++;
@ -88,7 +89,7 @@ class user_filter_text extends user_filter_type {
return '';
}
$ilike = sql_ilike();
$ilike = $DB->sql_ilike();
switch($operator) {
case 0: // contains