MDL-16669 dml: improved sql_substring(), added unit tests
This commit is contained in:
+1
-7
@@ -5402,14 +5402,8 @@ function context_moved($context, $newparent) {
|
||||
$params = array($newpath, $frompath);
|
||||
$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("?", $DB->sql_substr() .'(path, '.$len.' +1'.$substr3rdparam.')')."
|
||||
SET path = ".$DB->sql_concat("?", $DB->sql_substr("path", strlen($frompath)+1))."
|
||||
$setdepth
|
||||
WHERE path LIKE ?";
|
||||
$params = array($newpath, "{$frompath}/%");
|
||||
|
||||
Reference in New Issue
Block a user