MDL-47874 dml: add support for replace_all_text to oracle

And, at the same time, fix the implementation so all databases
will be using sql_substr() instead of harcoded "SUBSTRING".
This commit is contained in:
Eloy Lafuente (stronk7) 2014-10-31 02:35:46 +01:00
parent 32a69a7d7a
commit bacbb4e279
2 changed files with 11 additions and 1 deletions

View File

@ -2288,7 +2288,7 @@ abstract class moodle_database {
if (core_text::strlen($search) < core_text::strlen($replace)) {
$colsize = $column->max_length;
$sql = "UPDATE {".$table."}
SET $columnname = SUBSTRING(REPLACE($columnname, ?, ?), 1, $colsize)
SET $columnname = " . $this->sql_substr("REPLACE(" . $columnname . ", ?, ?)", 1, $colsize) . "
WHERE $columnname IS NOT NULL";
}
$this->execute($sql, array($search, $replace));

View File

@ -1731,6 +1731,16 @@ class oci_native_moodle_database extends moodle_database {
}
}
/**
* Does this driver support tool_replace?
*
* @since Moodle 2.8
* @return bool
*/
public function replace_all_text_supported() {
return true;
}
public function session_lock_supported() {
return true;
}