From: moodler Date: Sat, 11 Aug 2007 14:28:36 +0000 (+0000) Subject: Removed usage of table aliases with "as" as per MDL-10808 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=871ab9a3e287edf3edd689dbef802f661c0802b3;p=moodle.git Removed usage of table aliases with "as" as per MDL-10808 --- diff --git a/question/category_class.php b/question/category_class.php index 07b457d4df..c501ec6a82 100644 --- a/question/category_class.php +++ b/question/category_class.php @@ -416,7 +416,7 @@ class question_category_object { $cat->name = $newname; $cat->info = $newinfo; //never move category where it is the default - if (1 != count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories as c1, {$CFG->prefix}question_categories as c2 WHERE c2.id = $updateid AND c1.contextid = c2.contextid")){ + if (1 != count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories c1, {$CFG->prefix}question_categories c2 WHERE c2.id = $updateid AND c1.contextid = c2.contextid")){ if ($oldcat->contextid == $tocontextid){ // not moving contexts $cat->parent = $parentid; if (!update_record("question_categories", $cat)) { diff --git a/question/category_form.php b/question/category_form.php index 47ae3b2e96..84a0d28e18 100644 --- a/question/category_form.php +++ b/question/category_form.php @@ -17,7 +17,7 @@ class question_category_edit_form extends moodleform { $questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parent', 'quiz'), array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat)); $mform->setType('parent', PARAM_SEQUENCE); - if (1 == count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories as c1, {$CFG->prefix}question_categories as c2 WHERE c2.id = $currentcat AND c1.contextid = c2.contextid")){ + if (1 == count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories c1, {$CFG->prefix}question_categories c2 WHERE c2.id = $currentcat AND c1.contextid = c2.contextid")){ $mform->hardFreeze('parent'); } diff --git a/question/editlib.php b/question/editlib.php index abead698da..947e1e8cd9 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -114,8 +114,8 @@ function question_make_default_categories($contexts) { function question_can_delete_cat($todelete){ global $CFG; - $record = get_record_sql("SELECT count(*) as count, c1.contextid as contextid FROM {$CFG->prefix}question_categories as c1, - {$CFG->prefix}question_categories as c2 WHERE c2.id = $todelete + $record = get_record_sql("SELECT count(*) as count, c1.contextid as contextid FROM {$CFG->prefix}question_categories c1, + {$CFG->prefix}question_categories c2 WHERE c2.id = $todelete AND c1.contextid = c2.contextid GROUP BY c1.contextid"); $contextid = $record->contextid; $count = $record->count; @@ -935,4 +935,4 @@ function require_login_in_context($contextorid = null){ require_login(); } } -?> \ No newline at end of file +?> diff --git a/question/upgrade.php b/question/upgrade.php index efcc2335dd..e87daccb26 100644 --- a/question/upgrade.php +++ b/question/upgrade.php @@ -102,8 +102,8 @@ function question_delete_unused_random(){ $tofix = array(); $result = true; //delete all 'random' questions that are not been used in a quiz. - if ($qqis = get_records_sql("SELECT q.* FROM {$CFG->prefix}question as q LEFT JOIN ". - "({$CFG->prefix}quiz_question_instances as qqi) ". + if ($qqis = get_records_sql("SELECT q.* FROM {$CFG->prefix}question q LEFT JOIN ". + "({$CFG->prefix}quiz_question_instances qqi) ". "ON (q.id = qqi.question) WHERE q.qtype='random' AND qqi.question IS NULL")){ $qqilist = join(array_keys($qqis), ','); $result = $result && delete_records_select('question', "id IN ($qqilist)"); @@ -118,7 +118,7 @@ function question_cwqpfs_to_update($categories = null){ //any cats with questions picking from subcats? if (!$cwqpfs = get_records_sql_menu("SELECT DISTINCT qc.id, 1 ". - "FROM {$CFG->prefix}question as q, {$CFG->prefix}question_categories as qc ". + "FROM {$CFG->prefix}question q, {$CFG->prefix}question_categories qc ". "WHERE q.qtype='random' AND qc.id = q.category AND q.questiontext = 1")){ return array(); } else {