jpahullo / moodle-tool_mergeusers

Merge users script for Moodle

Home Page:https://moodle.org/plugins/view.php?plugin=tool_mergeusers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when even trying to start it up

rvyhmeister opened this issue · comments

Hello... tried to install on 4.1, and the install went flawlessly. Now I tried to access it, and I get an error... Running 4.1 with SQL Server as the DB server...

See the screenshot of the error below. Thanks in advance for any input.

image

Thanks @rvyhmeister for your feedback.

I think this is one of the first issues related to the SQL Server type.

If you can get closer to the problem and provide a patch, it would be quicker to solve.

Thanks for reporting.

Jordi

OK... did some digging in sqlsrv_native_moodle_database.php there is a function sqlsrvtype2moodletype, which specifies the valid types... type "char" is not in the list... I added it manually by adding

case 'CHAR':

just above the 'VARCHAR' line, and the error is now resolved.

Would appear that either the plugin needs to adjust the datatypes or we need to get the maintainers to recognize that char is a valid datatype for SQL Server...

Awesome! Thanks!

You @rvyhmeister identified the problem.

Modifying core due to a third-party plugin is not a solution, IMO.

We have to think about it to consider/transform somehow the "char" type into "varchar" or so into our plugin when proceeding. This would be the idea behind a patch to address this issue.

It would be very helpful if you can paste the text of the stack trace in some other comment or on your first comment, beside the screenshot.

Thanks

Here's the text of the stack trace... Have a great day!

error /i nva I idsq lsrvnativetype
More information about this error
Debug info:
Error code: invalidsqlsrvnativetype
$a contents: char
Stack trace:
• line 733 of /lib/dml/sqlsrv_native_moodle_database.php: dml_exception thrown
• line 592 of /lib/dml/sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->sqlsrvtype2moodletype()
• line 1174 of /lib/dml/moodle_database.php: call to sqlsrv_native_moodle_database->fetch_columns()
• line 436 of /admin/tool/mergeusers/lib/mergeusertool.php: call to moodle_database->get_columns()
• line 359 of /admin/tool/mergeusers/lib/mergeusertool.php: call to MergeUserTool->getCurrentUserFieldNames()
• line 175 of /admin/tool/mergeusers/lib/mergeusertool.php: call to MergeUserTool-> init()
• line 71 of /admin/tool/mergeusers/index.php: call to MergeUserTool->_construct()