-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
2.4.1
-
None
-
Windows, Microsoft SQL Server 2008 R2
-
Microsoft SQL
-
MOODLE_24_STABLE
Some of our teachers who tried to upload a new version of their course files ended up with a database read error. Here are the steps that can reproduce this error:
1. Add a new file resource to a course. The file could be for example “test.txt”.
2. Now suppose that the teacher has found a mistake in the file and modified the content of “test.txt” on his/her disk. Edit the file resource in Moodle, delete the original file and upload the corrected one.
3. Click on Save and return to the course.
Now you should see the Database read error message. However, the file has been updated correctly. The error occurs only if the file content is changed but the file name remains the same. If you change the file name, too, the error will not appear.
The PHP error log contains the following lines:
[20-Feb-2013 16:22:38] Default exception handler: Chyba čtení z databáze Debug: The data types ntext and nvarchar are incompatible in the equal to operator.
SELECT repositoryid, id FROM mdl_files_reference
WHERE referencehash = ? and reference = ?
[array (
0 => '03ee678baaa02a4f8275be3194c410d1c1622761',
1 => 'YTo2OntzOjk6ImNvbnRleHRpZCI7aTo0NDE0O3M6OToiY29tcG9uZW50IjtzOjEyOiJtb2RfcmVzb3VyY2UiO3M6NjoiaXRlbWlkIjtpOjA7czo4OiJmaWxlYXJlYSI7czo3OiJjb250ZW50IjtzOjg6ImZpbGVwYXRoIjtzOjE6Ii8iO3M6ODoiZmlsZW5hbWUiO3M6MTA6InNvdWJvci50eHQiO30=',
)]
Error code: dmlreadexception
- line 426 of \lib\dml\moodle_database.php: dml_read_exception thrown
- line 256 of \lib\dml\mssql_native_moodle_database.php: call to moodle_database->query_end()
- line 713 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end()
- line 1856 of \lib\filestorage\file_storage.php: call to mssql_native_moodle_database->get_recordset_sql()
- line 883 of \lib\filelib.php: call to file_storage->update_references_to_storedfile()
- line 465 of \mod\resource\locallib.php: call to file_save_draft_area_files()
- line 121 of \mod\resource\lib.php: call to resource_set_mainfile()
- line 371 of \course\modedit.php: call to resource_update_instance()
From the report, it seems that this bug is MS SQL specific and that it is connected to MDL-11270.
A worse scenario is when the teacher updates also the name of the file resource:
1. Add a new file resource to a course. The file could be for example “test.txt”. Set the name that should be displayed on the course page for example to “Test - version 2011/2012”.
2. Modify the content of “test.txt” on your disk.
3. Edit the file resource in Moodle. Change the name of the resource “Test - version 2012/2013” (first item in the form). Then delete the original file and upload the corrected one.
4. Click on the “Save and return to the course” button.
The database read error appears again. The new file was uploaded correctly. However the resource name on the course page is still “Test 2011/2012”. I clicked on the Rename icon and the text changed itself to “Test 2011/2013”! So I pressed Enter to save it, but there is “Test 2011/2012” again. I had to click on the Edit icon and fix the resource name there.
Moodle version: Moodle 2.4.1+ (Build: 20130118). But I had the same problem in the previous version, too.
- duplicates
-
MDL-38091 Error on overwriting My private files with Oracle & SQL*Server
-
- Closed
-