*BUT* notice that we have to place a single quote around the server name as the argument to the udf. In the MySQL database the single quote is escaped with a backslash, and every time anyone opens the external db enrollment plugin configuration page the quote is escaped yet again, i.e. the backslash is escaped with another backslash.
What's worse is that when we run enrol_database_sync.php the query end us like
SELECT Username FROM CUS_udfEnrollment(\'moodle3\') WHERE CoursecodeYrTrmSection = 'ACTG062_2007_10_A' AND Role = 'student'
and the script views the backslahes as an SQL syntax error.Has anyone confronted this issue before?
I am considering adding a stripslashes cleanup to a cron job, to keep the number of backslashes down to a reasonable number (=1!) and adding some special lines of code to enrol.php to remove the backslashes in the generation of the SQL. Still, if there is a solution that doesn't involve hacking the enrol.php code I would love to hear about it.
Thanks,
Alan