MDL-16669 dml: improved sql_substring(), added unit tests

This commit is contained in:
skodak
2008-10-28 15:11:10 +00:00
parent d669160891
commit 655bbf511d
13 changed files with 87 additions and 40 deletions
+1 -7
View File
@@ -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}/%");