From 8c44681c23fe20e3c578f6db47b0ac67df0ac4cb Mon Sep 17 00:00:00 2001 From: stronk7 Date: Wed, 24 Sep 2008 17:35:42 +0000 Subject: [PATCH] Substring MSSQL function *requires* 3rd parameter - MDL-16655 ; merged from 19_STABLE --- lib/accesslib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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}/%"); -- 2.39.5