From: moodler Date: Wed, 25 Oct 2006 09:04:25 +0000 (+0000) Subject: Merged AS keyword fixes from stable MDL-7207 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f274fe073cbce5b0a5ca8062121a975146254120;p=moodle.git Merged AS keyword fixes from stable MDL-7207 --- diff --git a/auth/ldap/lib.php b/auth/ldap/lib.php index 7f4dbbe1a1..ccf96dfe90 100644 --- a/auth/ldap/lib.php +++ b/auth/ldap/lib.php @@ -551,7 +551,7 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) { } if ( $do_updates && !(empty($updatekeys)) ) { // run updates only if relevant - $users = get_records_sql('SELECT u.username, u.id FROM ' . $CFG->prefix . 'user AS u WHERE u.deleted=0 and u.auth=\'' . AUTH_LDAP_NAME . '\'' ); + $users = get_records_sql('SELECT u.username, u.id FROM ' . $CFG->prefix . 'user u WHERE u.deleted=0 and u.auth=\'' . AUTH_LDAP_NAME . '\'' ); if (!empty($users)) { print "User entries to update: ". count($users). "\n"; diff --git a/mod/data/filter.php b/mod/data/filter.php index e8f6e8bb70..2030eb70b8 100644 --- a/mod/data/filter.php +++ b/mod/data/filter.php @@ -29,10 +29,10 @@ 'dr.id AS recordid, ' . 'dc.content AS content, ' . 'd.id AS dataid ' . - 'FROM '.$CFG->prefix.'data AS d, ' . - $CFG->prefix.'data_fields AS df, ' . - $CFG->prefix.'data_records AS dr, ' . - $CFG->prefix.'data_content AS dc ' . + 'FROM '.$CFG->prefix.'data d, ' . + $CFG->prefix.'data_fields df, ' . + $CFG->prefix.'data_records dr, ' . + $CFG->prefix.'data_content dc ' . "WHERE (d.course = '$courseid' or d.course = '".SITEID."')" . 'AND d.id = df.dataid ' . 'AND df.id = dc.fieldid ' . diff --git a/mod/data/lib.php b/mod/data/lib.php index ff1c3d6844..d045931b84 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -1225,11 +1225,11 @@ function data_fieldname_exists($name, $dataid, $fieldid=0) { $LIKE = sql_ilike(); if ($fieldid) { - return record_exists_sql("SELECT * from {$CFG->prefix}data_fields AS df + return record_exists_sql("SELECT * from {$CFG->prefix}data_fields df WHERE df.name $LIKE '$name' AND df.dataid = $dataid AND ((df.id < $fieldid) OR (df.id > $fieldid))"); } else { - return record_exists_sql("SELECT * from {$CFG->prefix}data_fields AS df + return record_exists_sql("SELECT * from {$CFG->prefix}data_fields df WHERE df.name $LIKE '$name' AND df.dataid = $dataid"); } } diff --git a/mod/forum/lib.php b/mod/forum/lib.php index d317f17d0f..f4500cdcf9 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1147,8 +1147,8 @@ function forum_get_readable_forums($userid, $courseid=0) { cm.id AS cmid, cm.visible AS cmvisible, cm.groupmode AS cmgroupmode - FROM {$CFG->prefix}course_modules AS cm, - {$CFG->prefix}forum AS f + FROM {$CFG->prefix}course_modules cm, + {$CFG->prefix}forum f WHERE cm.instance = f.id AND cm.course = {$course->id} AND cm.module = {$forummod->id} @@ -2878,8 +2878,8 @@ function forum_discussions_user_has_posted_in($forumid, $userid) { $haspostedsql = "SELECT DISTINCT(d.id) AS id, d.* - FROM {$CFG->prefix}forum_posts AS p, - {$CFG->prefix}forum_discussions AS d + FROM {$CFG->prefix}forum_posts p, + {$CFG->prefix}forum_discussions d WHERE p.discussion = d.id AND d.forum = $forumid AND p.userid = $userid"; diff --git a/mod/glossary/filter.php b/mod/glossary/filter.php index 5175dc3a2f..a96013b75e 100644 --- a/mod/glossary/filter.php +++ b/mod/glossary/filter.php @@ -55,8 +55,8 @@ function glossary_filter($courseid, $text) { $aliases = get_records_sql('SELECT ga.id, ge.glossaryid, ga.alias as concept, ge.concept as originalconcept, casesensitive, 0 AS category, fullmatch - FROM '.$CFG->prefix.'glossary_alias AS ga, - '.$CFG->prefix.'glossary_entries AS ge + FROM '.$CFG->prefix.'glossary_alias ga, + '.$CFG->prefix.'glossary_entries ge WHERE ga.entryid = ge.id AND ge.glossaryid IN ('.$glossarylist.') AND ge.usedynalink != 0 diff --git a/mod/hotpot/attempt.php b/mod/hotpot/attempt.php index 6d55baf32c..3b8ffd32da 100644 --- a/mod/hotpot/attempt.php +++ b/mod/hotpot/attempt.php @@ -434,9 +434,9 @@ function hotpot_set_attempt_details(&$attempt) { SELECT r.* FROM - {$CFG->prefix}hotpot_attempts AS a, - {$CFG->prefix}hotpot_questions AS q, - {$CFG->prefix}hotpot_responses AS r + {$CFG->prefix}hotpot_attempts a, + {$CFG->prefix}hotpot_questions q, + {$CFG->prefix}hotpot_responses r WHERE a.clickreportid = $attempt->clickreportid AND a.id = r.attempt AND diff --git a/mod/hotpot/db/update_to_v2.php b/mod/hotpot/db/update_to_v2.php index e5857be1b1..41f1dcc334 100644 --- a/mod/hotpot/db/update_to_v2.php +++ b/mod/hotpot/db/update_to_v2.php @@ -119,7 +119,7 @@ function hotpot_remove_orphans($secondarytable, $secondarykeyfield, $primarytabl SELECT t2.$secondarykeyfield, t2.$secondarykeyfield FROM - {$CFG->prefix}$secondarytable AS t2 LEFT JOIN {$CFG->prefix}$primarytable AS t1 + {$CFG->prefix}$secondarytable t2 LEFT JOIN {$CFG->prefix}$primarytable t1 ON (t2.$secondarykeyfield = t1.id) WHERE t1.$primarykeyfield IS NULL @@ -355,7 +355,7 @@ function hotpot_update_to_v2_1() { $sql = " INSERT INTO {$CFG->prefix}$table (attempt, details) SELECT a.id AS attempt, a.details AS details - FROM {$CFG->prefix}hotpot_attempts AS a + FROM {$CFG->prefix}hotpot_attempts a WHERE a.details IS NOT NULL AND a.details <> '' AND a.details LIKE '' diff --git a/mod/hotpot/index.php b/mod/hotpot/index.php index 1563381820..14acf5571d 100644 --- a/mod/hotpot/index.php +++ b/mod/hotpot/index.php @@ -212,7 +212,7 @@ $start = microtime(); // get total number of attempts, users and details for these hotpots - $tables = "{$CFG->prefix}hotpot_attempts AS a"; + $tables = "{$CFG->prefix}hotpot_attempts a"; $fields = " a.hotpot AS hotpot, COUNT(DISTINCT a.clickreportid) AS attemptcount, @@ -229,7 +229,7 @@ $usejoin = 0; if (has_capability('mod/hotpot:grade', get_context_instance(CONTEXT_SYSTEM, SITEID)) && $usejoin) { // join attempts table and details table - $tables .= ",{$CFG->prefix}hotpot_details AS d"; + $tables .= ",{$CFG->prefix}hotpot_details d"; $fields .= ',COUNT(DISTINCT d.id) AS detailcount'; $select .= " AND a.id=d.attempt"; diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php index e5bea03dfc..6cdeaf602f 100644 --- a/mod/hotpot/lib.php +++ b/mod/hotpot/lib.php @@ -759,10 +759,10 @@ function hotpot_get_all_instances_in_course($modulename, $course) { cs.visible AS sectionvisible, thismodule.* FROM - {$CFG->prefix}course_modules AS cm, - {$CFG->prefix}course_sections AS cs, - {$CFG->prefix}modules AS m, - {$CFG->prefix}$modulename AS thismodule + {$CFG->prefix}course_modules cm, + {$CFG->prefix}course_sections cs, + {$CFG->prefix}modules m, + {$CFG->prefix}$modulename thismodule WHERE m.name = '$modulename' AND m.id = cm.module AND @@ -963,8 +963,8 @@ function hotpot_print_recent_activity($course, $isteacher, $timestart) { h.name AS name, COUNT(*) AS count_attempts FROM - {$CFG->prefix}hotpot AS h, - {$CFG->prefix}hotpot_attempts AS a + {$CFG->prefix}hotpot h, + {$CFG->prefix}hotpot_attempts a WHERE h.course = $course->id AND h.id = a.hotpot @@ -1021,10 +1021,10 @@ function hotpot_get_recent_mod_activity(&$activities, &$index, $sincetime, $cour cm.instance, cm.section, u.firstname, u.lastname, u.picture FROM - {$CFG->prefix}hotpot_attempts AS a, - {$CFG->prefix}hotpot AS h, - {$CFG->prefix}course_modules AS cm, - {$CFG->prefix}user AS u + {$CFG->prefix}hotpot_attempts a, + {$CFG->prefix}hotpot h, + {$CFG->prefix}course_modules cm, + {$CFG->prefix}user u WHERE a.timefinish > '$sincetime' AND a.id = a.clickreportid diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index 471d87919e..c4899b224b 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -157,7 +157,7 @@ } // database table and selection conditions - $table = "{$CFG->prefix}hotpot_attempts AS a"; + $table = "{$CFG->prefix}hotpot_attempts a"; $select = "a.hotpot=$hotpot->id AND a.userid IN ($user_ids)"; if ($mode!='overview') { $select .= ' AND a.status<>'.HOTPOT_STATUS_INPROGRESS; @@ -226,7 +226,7 @@ if ($select) { // add user information to SQL query $select .= ' AND a.userid = u.id'; - $table .= ", {$CFG->prefix}user AS u"; + $table .= ", {$CFG->prefix}user u"; $order = "u.lastname, a.attempt, a.timefinish"; // get the attempts (at last!) $attempts = get_records_sql("SELECT $fields FROM $table WHERE $select ORDER BY $order"); @@ -462,8 +462,8 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) { SELECT u.id, u.firstname, u.lastname FROM - {$CFG->prefix}user AS u, - {$CFG->prefix}hotpot_attempts AS ha + {$CFG->prefix}user u, + {$CFG->prefix}hotpot_attempts ha WHERE u.id = ha.userid AND ha.hotpot=$hotpot->id ORDER BY diff --git a/mod/quiz/backuplib.php b/mod/quiz/backuplib.php index 121d483796..8e50fbd34a 100644 --- a/mod/quiz/backuplib.php +++ b/mod/quiz/backuplib.php @@ -94,8 +94,8 @@ // Now we look for random questions that can use questions from subcategories // because we will have to add these subcategories $sql = "SELECT t.id, t.category - FROM {$CFG->prefix}quiz_question_instances AS g, - {$CFG->prefix}question AS t + FROM {$CFG->prefix}quiz_question_instances g, + {$CFG->prefix}question t $from WHERE $where t.id = g.question AND t.qtype = '".RANDOM."' @@ -531,4 +531,4 @@ WHERE g.quiz = $instanceid"); } -?> \ No newline at end of file +?> diff --git a/mod/survey/lib.php b/mod/survey/lib.php index 263c364f9c..3fd30277c4 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -217,7 +217,7 @@ function survey_get_responses($surveyid, $groupid) { global $CFG; if ($groupid) { - $groupsdb = ", {$CFG->prefix}groups_members AS gm"; + $groupsdb = ", {$CFG->prefix}groups_members gm"; $groupsql = "AND gm.groupid = $groupid AND u.id = gm.userid"; } else { $groupsdb = ""; @@ -226,8 +226,8 @@ function survey_get_responses($surveyid, $groupid) { return get_records_sql("SELECT MAX(a.time) as time, u.id, u.firstname, u.lastname, u.picture - FROM {$CFG->prefix}survey_answers AS a, - {$CFG->prefix}user AS u $groupsdb + FROM {$CFG->prefix}survey_answers a, + {$CFG->prefix}user u $groupsdb WHERE a.survey = $surveyid AND a.userid = u.id $groupsql GROUP BY u.id, u.firstname, u.lastname, u.picture