Fixing bug 3502 - 2 postgres problems - one in db creation (my fault) and one in '' instead of 0 for int in sql query

This commit is contained in:
mjollnir_
2005-06-15 22:36:20 +00:00
parent 7070d53107
commit 8f3e3695e3
4 changed files with 13 additions and 5 deletions
+9 -1
View File
@@ -523,7 +523,7 @@ function quiz_upgrade($oldversion) {
template_vars text NOT NULL
);");
modify_database ('', "CREATE TABLE prefix_quiz_rqp_type (
modify_database ('', "CREATE TABLE prefix_quiz_rqp_types (
id SERIAL PRIMARY KEY,
name varchar(255) NOT NULL default '',
rendering_server varchar(255) NOT NULL default '',
@@ -912,6 +912,14 @@ function quiz_upgrade($oldversion) {
$db->debug = $olddebug;
}
if ($oldversion < 2005060301) {
execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_type RENAME TO '.$CFG->prefix.'quiz_rqp_types');
execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_type_id_seq RENAME TO '.$CFG->prefix.'rqp_types_id_seq');
execute_sql('ALTER TABLE '.$CFG->prefix.'quiz_rqp_types ALTER COLUMN id SET DEFAULT nextval(\''.$CFG->prefix.'quiz_rqp_types_id_seq\')');
execute_sql('DROP INDEX '.$CFG->prefix.'quiz_rqp_type_name_uk');
execute_sql('CREATE UNIQUE INDEX '.$CFG->prefix.'quiz_rqp_types_name_uk ON '.$CFG->prefix.'quiz_rqp_types (name);');
}
return true;
}
+1 -1
View File
@@ -410,7 +410,7 @@ CREATE TABLE prefix_quiz_rqp_states (
# Table structure for table prefix_quiz_rqp_type
#
CREATE TABLE prefix_quiz_rqp_type (
CREATE TABLE prefix_quiz_rqp_types (
id SERIAL PRIMARY KEY,
name varchar(255) NOT NULL default '',
rendering_server varchar(255) NOT NULL default '',
+2 -2
View File
@@ -194,7 +194,7 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true) {
echo "<p align=\"center\">";
print_string("noquestions", "quiz");
echo "</p>";
return;
return 0;
}
if (!$questions = get_records_sql("SELECT q.*,c.course
@@ -205,7 +205,7 @@ function quiz_print_question_list($quiz, $allowdelete=true, $showbreaks=true) {
echo "<p align=\"center\">";
print_string("noquestions", "quiz");
echo "</p>";
return;
return 0;
}
$count = 0;
+1 -1
View File
@@ -5,7 +5,7 @@
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005060300; // The (date) version of this module
$module->version = 2005060301; // The (date) version of this module
$module->requires = 2005021600; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?