From: stronk7 Date: Wed, 24 Sep 2008 17:35:42 +0000 (+0000) Subject: Substring MSSQL function *requires* 3rd parameter - MDL-16655 ; merged from 19_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8c44681c23fe20e3c578f6db47b0ac67df0ac4cb;p=moodle.git Substring MSSQL function *requires* 3rd parameter - MDL-16655 ; merged from 19_STABLE --- diff --git a/lib/accesslib.php b/lib/accesslib.php index 8913bceeca..84a731d62d 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -5403,8 +5403,13 @@ function context_moved($context, $newparent) { $DB->execute($sql, $params); $len = strlen($frompath); + /// MDL-16655 - Substring MSSQL function *requires* 3rd parameter + $substr3rdparam = ''; + if ($DB->get_dbfamily() == 'mssql') { + $substr3rdparam = ', len(path)'; + } $sql = "UPDATE {context} - SET path = ".$DB->sql_concat("?", 'SUBSTR(path, '.$len.' +1)')." + SET path = ".$DB->sql_concat("?", $DB->sql_substr() .'(path, '.$len.' +1'.$substr3rdparam.')')." $setdepth WHERE path LIKE ?"; $params = array($newpath, "{$frompath}/%");