Non-core contributed modules

Wrong parameter for rank field in mdl_questionnaire_response_rank table

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.9, 2.0
  • Fix Version/s: 1.9.1, 2.0
  • Component/s: Module: Questionnaire
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

From 1.9 version in the mdl_questionnaire_response_rank table, the rank field type has been changed from INT to BIGINT UNSIGNED. This provokes a bug, because N/A responses expect to be saved with the -1 value and of course they are saved as 1...
Please remove the UNSIGNED attribute from BIGINT ...
Joseph

Activity

Hide
Joseph Rézeau added a comment -

Sorry, was wrong module...

Show
Joseph Rézeau added a comment - Sorry, was wrong module...
Hide
Joseph Rézeau added a comment -

re-assigned to Mike

Show
Joseph Rézeau added a comment - re-assigned to Mike
Hide
Mike Churchward added a comment -

Fixed install.xml to use a signed field for the rank field. Added update code for 1.9 installations primarily.

Show
Mike Churchward added a comment - Fixed install.xml to use a signed field for the rank field. Added update code for 1.9 installations primarily.
Hide
Joseph Rézeau added a comment -

Upgrading with latest bug fix throws up errors on my local moodle installs:
------------------------------------------
on my moodle 1.9:
questionnaire module needs upgrading

Notice: Undefined variable: dbtype in C:\moodle\www\moodle19dev\moodle\lib\xmldb\classes\generators\mysql\mysql.class.php on line 166
(mysql): ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL DEFAULT NULL' at line 1

ADOConnection._Execute(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL, false) % line 891, file: adodb.inc.php
ADOConnection.Execute(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL) % line 89, file: dmllib.php
execute_sql(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL, true) % line 2223, file: dmllib.php
execute_sql_arr(Array[1], true, true) % line 1127, file: ddllib.php
change_field_type(Object:XMLDBTable, Object:XMLDBField, true, true) % line 1159, file: ddllib.php

ErrorScroll to next warning
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL DEFAULT NULL' at line 1

ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL

  • line 103 of lib\dmllib.php: call to debugging()
  • line 2223 of lib\dmllib.php: call to execute_sql()
  • line 1127 of lib\ddllib.php: call to execute_sql_arr()
  • line 1159 of lib\ddllib.php: call to change_field_type()
  • line 123 of mod\questionnaire\db\upgrade.php: call to change_field_unsigned()
  • line 338 of lib\adminlib.php: call to xmldb_questionnaire_upgrade()
  • line 422 of admin\index.php: call to upgrade_activity_modules()

Scroll to previous warningUpgrading questionnaire from 2007120103 to 2007120104 FAILED!Scroll to continue button
-----------------------------------------
on my moodle 2.0 :
questionnaire module needs upgrading
Deprecated ddllib function used!

  • line 304 of lib\ddllib.php: call to debugging()
  • line 171 of mod\questionnaire\db\upgrade.php: call to change_field_unsigned()
  • line 317 of lib\adminlib.php: call to xmldb_questionnaire_upgrade()
  • line 392 of admin\index.php: call to upgrade_activity_modules()

Notice: Undefined variable: dbtype in C:\moodle\www\moodle20\moodle\lib\ddl\mysql_sql_generator.php on line 165
(mysql): ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1

ADOConnection._Execute(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL, false) % line 893, file: adodb.inc.php
ADOConnection.Execute(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL) % line 153, file: adodb_moodle_database.php
adodb_moodle_database.change_database_structure(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL) % line 81, file: database_manager.php
database_manager.execute_sql(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL, true) % line 62, file: database_manager.php
database_manager.execute_sql_arr(Array[1], true, true) % line 705, file: database_manager.php

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1

ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL
[NULL]

  • line 98 of lib\dml\moodle_database.php: call to debugging()
  • line 157 of lib\dml\adodb_moodle_database.php: call to moodle_database->report_error()
  • line 81 of lib\ddl\database_manager.php: call to adodb_moodle_database->change_database_structure()
  • line 62 of lib\ddl\database_manager.php: call to database_manager->execute_sql()
  • line 705 of lib\ddl\database_manager.php: call to database_manager->execute_sql_arr()
  • line 737 of lib\ddl\database_manager.php: call to database_manager->change_field_type()
  • line 305 of lib\ddllib.php: call to database_manager->change_field_unsigned()
  • line 171 of mod\questionnaire\db\upgrade.php: call to change_field_unsigned()
  • line 317 of lib\adminlib.php: call to xmldb_questionnaire_upgrade()
  • line 392 of admin\index.php: call to upgrade_activity_modules()

Error

Joseph

Show
Joseph Rézeau added a comment - Upgrading with latest bug fix throws up errors on my local moodle installs: ------------------------------------------ on my moodle 1.9: questionnaire module needs upgrading Notice: Undefined variable: dbtype in C:\moodle\www\moodle19dev\moodle\lib\xmldb\classes\generators\mysql\mysql.class.php on line 166 (mysql): ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL DEFAULT NULL' at line 1 ADOConnection._Execute(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL, false) % line 891, file: adodb.inc.php ADOConnection.Execute(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL) % line 89, file: dmllib.php execute_sql(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL, true) % line 2223, file: dmllib.php execute_sql_arr(Array[1], true, true) % line 1127, file: ddllib.php change_field_type(Object:XMLDBTable, Object:XMLDBField, true, true) % line 1159, file: ddllib.php ErrorScroll to next warning You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL DEFAULT NULL' at line 1 ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL DEFAULT NULL
  • line 103 of lib\dmllib.php: call to debugging()
  • line 2223 of lib\dmllib.php: call to execute_sql()
  • line 1127 of lib\ddllib.php: call to execute_sql_arr()
  • line 1159 of lib\ddllib.php: call to change_field_type()
  • line 123 of mod\questionnaire\db\upgrade.php: call to change_field_unsigned()
  • line 338 of lib\adminlib.php: call to xmldb_questionnaire_upgrade()
  • line 422 of admin\index.php: call to upgrade_activity_modules()
Scroll to previous warningUpgrading questionnaire from 2007120103 to 2007120104 FAILED!Scroll to continue button ----------------------------------------- on my moodle 2.0 : questionnaire module needs upgrading Deprecated ddllib function used!
  • line 304 of lib\ddllib.php: call to debugging()
  • line 171 of mod\questionnaire\db\upgrade.php: call to change_field_unsigned()
  • line 317 of lib\adminlib.php: call to xmldb_questionnaire_upgrade()
  • line 392 of admin\index.php: call to upgrade_activity_modules()
Notice: Undefined variable: dbtype in C:\moodle\www\moodle20\moodle\lib\ddl\mysql_sql_generator.php on line 165 (mysql): ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 ADOConnection._Execute(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL, false) % line 893, file: adodb.inc.php ADOConnection.Execute(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL) % line 153, file: adodb_moodle_database.php adodb_moodle_database.change_database_structure(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL) % line 81, file: database_manager.php database_manager.execute_sql(ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL, true) % line 62, file: database_manager.php database_manager.execute_sql_arr(Array[1], true, true) % line 705, file: database_manager.php You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank NULL [NULL]
  • line 98 of lib\dml\moodle_database.php: call to debugging()
  • line 157 of lib\dml\adodb_moodle_database.php: call to moodle_database->report_error()
  • line 81 of lib\ddl\database_manager.php: call to adodb_moodle_database->change_database_structure()
  • line 62 of lib\ddl\database_manager.php: call to database_manager->execute_sql()
  • line 705 of lib\ddl\database_manager.php: call to database_manager->execute_sql_arr()
  • line 737 of lib\ddl\database_manager.php: call to database_manager->change_field_type()
  • line 305 of lib\ddllib.php: call to database_manager->change_field_unsigned()
  • line 171 of mod\questionnaire\db\upgrade.php: call to change_field_unsigned()
  • line 317 of lib\adminlib.php: call to xmldb_questionnaire_upgrade()
  • line 392 of admin\index.php: call to upgrade_activity_modules()
Error Joseph
Hide
Mike Churchward added a comment -

Hmmm... Looks like you may have to define the entire field's attributes in order to make a change. Not sure why they provide direct functions then. I have committed another change. Can you test that?

Show
Mike Churchward added a comment - Hmmm... Looks like you may have to define the entire field's attributes in order to make a change. Not sure why they provide direct functions then. I have committed another change. Can you test that?
Hide
Joseph Rézeau added a comment -

The new committed change does work. I still get an error message, but the RANK field is corrected set. So all is well...
Joseph
The error message I get (on moodle 2.0 only, no error on 1.9):
-----------------------------------------------
questionnaire module needs upgrading
Deprecated ddllib function used!

  • line 304 of lib\ddllib.php: call to debugging()
  • line 172 of mod\questionnaire\db\upgrade.php: call to change_field_unsigned()
  • line 317 of lib\adminlib.php: call to xmldb_questionnaire_upgrade()
  • line 392 of admin\index.php: call to upgrade_activity_modules()

(mysql): ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank BIGINT(11) NOT NULL DEFAULT 0 after choice_id
questionnaire tables have been set up correctly
***************************************************

Show
Joseph Rézeau added a comment - The new committed change does work. I still get an error message, but the RANK field is corrected set. So all is well... Joseph The error message I get (on moodle 2.0 only, no error on 1.9): ----------------------------------------------- questionnaire module needs upgrading Deprecated ddllib function used!
  • line 304 of lib\ddllib.php: call to debugging()
  • line 172 of mod\questionnaire\db\upgrade.php: call to change_field_unsigned()
  • line 317 of lib\adminlib.php: call to xmldb_questionnaire_upgrade()
  • line 392 of admin\index.php: call to upgrade_activity_modules()
(mysql): ALTER TABLE mdl_questionnaire_response_rank MODIFY COLUMN rank BIGINT(11) NOT NULL DEFAULT 0 after choice_id questionnaire tables have been set up correctly ***************************************************

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: