Substring MSSQL function *requires* 3rd parameter - MDL-16655 ; merged from 19_STABLE

This commit is contained in:
stronk7 2008-09-24 17:35:42 +00:00
parent bff34a6747
commit 8c44681c23

View File

@ -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}/%");