Changes throughout Moodle to remove any reserved words from the

Moodle tables.

ie user -> userid in many tables, plus in user_students
   start -> starttime and end -> endtime

I've just done all this as carefully as I could ... I don't think
I missed anything but it's pretty intensive work and I'd be fooling myself
if I didn't think I'd missed a couple.

Note that this version should pretty much be able to bootstrap itself
using PostgreSQL now ... but this is untested
This commit is contained in:
moodler 2002-12-23 09:39:26 +00:00
parent 1f48942e7d
commit ebc3bd2b24
68 changed files with 277 additions and 461 deletions

View file

@ -14,6 +14,9 @@ function choice_upgrade($oldversion) {
execute_sql(" ALTER TABLE `choice` ADD `answer5` varchar(255) NOT NULL AFTER `answer4`");
execute_sql(" ALTER TABLE `choice` ADD `answer6` varchar(255) NOT NULL AFTER `answer5`");
}
if ($oldversion < 2002122300) {
execute_sql("ALTER TABLE `choice_answers` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
}
return true;
}

View file

@ -40,7 +40,7 @@ CREATE TABLE prefix_choice (
CREATE TABLE prefix_choice_answers (
id int(10) unsigned NOT NULL auto_increment,
choice int(10) unsigned NOT NULL default '0',
user int(10) unsigned NOT NULL default '0',
userid int(10) unsigned NOT NULL default '0',
answer tinyint(4) NOT NULL default '0',
timemodified int(10) NOT NULL default '0',
PRIMARY KEY (id),

View file

@ -4,16 +4,6 @@ function choice_upgrade($oldversion) {
// This function does anything necessary to upgrade
// older versions to match current functionality
if ($oldversion < 2002090800) {
execute_sql(" ALTER TABLE `choice` CHANGE `answer1` `answer1` VARCHAR( 255 )");
execute_sql(" ALTER TABLE `choice` CHANGE `answer2` `answer2` VARCHAR( 255 )");
}
if ($oldversion < 2002102400) {
execute_sql(" ALTER TABLE `choice` ADD `answer3` varchar(255) NOT NULL AFTER `answer2`");
execute_sql(" ALTER TABLE `choice` ADD `answer4` varchar(255) NOT NULL AFTER `answer3`");
execute_sql(" ALTER TABLE `choice` ADD `answer5` varchar(255) NOT NULL AFTER `answer4`");
execute_sql(" ALTER TABLE `choice` ADD `answer6` varchar(255) NOT NULL AFTER `answer5`");
}
return true;
}

View file

@ -38,7 +38,7 @@ CREATE TABLE choice (
CREATE TABLE choice_answers (
id SERIAL PRIMARY KEY,
choice integer NOT NULL default '0',
"user" integer NOT NULL default '0',
userid integer NOT NULL default '0',
answer integer NOT NULL default '0',
timemodified integer NOT NULL default '0'
);

View file

@ -28,7 +28,7 @@
notice("There are no choices", "../../course/view.php?id=$course->id");
}
if ( $allanswers = get_records("choice_answers", "user", $USER->id)) {
if ( $allanswers = get_records("choice_answers", "userid", $USER->id)) {
foreach ($allanswers as $aa) {
$answers[$aa->choice] = $aa;
}

View file

@ -3,7 +3,7 @@
$CHOICE_MAX_NUMBER = 6;
function choice_user_outline($course, $user, $mod, $choice) {
if ($current = get_record("choice_answers", "choice", $choice->id, "user", $user->id)) {
if ($current = get_record("choice_answers", "choice", $choice->id, "userid", $user->id)) {
$result->info = "'".choice_get_answer($choice, $current->answer)."'";
$result->time = $current->timemodified;
return $result;
@ -13,7 +13,7 @@ function choice_user_outline($course, $user, $mod, $choice) {
function choice_user_complete($course, $user, $mod, $choice) {
if ($current = get_record("choice_answers", "choice", $choice->id, "user", $user->id)) {
if ($current = get_record("choice_answers", "choice", $choice->id, "userid", $user->id)) {
$result->info = "'".choice_get_answer($choice, $current->answer)."'";
$result->time = $current->timemodified;
echo get_string("answered", "choice").": $result->info , last updated ".userdate($result->time);

View file

@ -41,7 +41,7 @@
if ( $allanswers = get_records("choice_answers", "choice", $choice->id)) {
foreach ($allanswers as $aa) {
$answers[$aa->user] = $aa;
$answers[$aa->userid] = $aa;
}
} else {
$answers = array () ;

View file

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2002102400;
$module->version = 2002122300;
$module->cron = 0;
?>

View file

@ -19,7 +19,7 @@
error("Course module is incorrect");
}
if ($current = get_record("choice_answers", "choice", $choice->id, "user", $USER->id)) {
if ($current = get_record("choice_answers", "choice", $choice->id, "userid", $USER->id)) {
$answerchecked[$current->answer] = "CHECKED";
}
@ -36,7 +36,7 @@
add_to_log($course->id, "choice", "update", "view.php?id=$cm->id", "$choice->id");
} else {
$newanswer->choice = $choice->id;
$newanswer->user = $USER->id;
$newanswer->userid = $USER->id;
$newanswer->answer = $form->answer;
$newanswer->timemodified = $timenow;
if (! insert_record("choice_answers", $newanswer)) {