Issue Details (XML | Word | Printable)

Key: CONTRIB-429
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Mike Churchward
Reporter: Joseph Rézeau
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Non-core contributed modules

Wrong parameter for rank field in mdl_questionnaire_response_rank table

Created: 16/May/08 04:57 AM   Updated: 16/May/08 10:36 PM
Return to search
Component/s: Module: Questionnaire
Affects Version/s: 1.9, 2.0
Fix Version/s: 1.9.1, 2.0

Participants: Joseph Rézeau and Mike Churchward
Security Level: None
Resolved date: 16/May/08
Affected Branches: MOODLE_19_STABLE, MOODLE_20_STABLE
Fixed Branches: MOODLE_19_STABLE, MOODLE_20_STABLE


 Description  « Hide
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

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Joseph Rézeau added a comment - 16/May/08 05:00 AM
Sorry, was wrong module...

Joseph Rézeau added a comment - 16/May/08 05:00 AM
re-assigned to Mike

Mike Churchward added a comment - 16/May/08 08:42 PM
Fixed install.xml to use a signed field for the rank field. Added update code for 1.9 installations primarily.

Joseph Rézeau added a comment - 16/May/08 09:40 PM
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


Mike Churchward added a comment - 16/May/08 10:19 PM
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?

Joseph Rézeau added a comment - 16/May/08 10:36 PM
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
***************************************************