mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
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:
parent
32a69a7d7a
commit
bacbb4e279
2 changed files with 11 additions and 1 deletions
|
@ -2288,7 +2288,7 @@ abstract class moodle_database {
|
||||||
if (core_text::strlen($search) < core_text::strlen($replace)) {
|
if (core_text::strlen($search) < core_text::strlen($replace)) {
|
||||||
$colsize = $column->max_length;
|
$colsize = $column->max_length;
|
||||||
$sql = "UPDATE {".$table."}
|
$sql = "UPDATE {".$table."}
|
||||||
SET $columnname = SUBSTRING(REPLACE($columnname, ?, ?), 1, $colsize)
|
SET $columnname = " . $this->sql_substr("REPLACE(" . $columnname . ", ?, ?)", 1, $colsize) . "
|
||||||
WHERE $columnname IS NOT NULL";
|
WHERE $columnname IS NOT NULL";
|
||||||
}
|
}
|
||||||
$this->execute($sql, array($search, $replace));
|
$this->execute($sql, array($search, $replace));
|
||||||
|
|
|
@ -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() {
|
public function session_lock_supported() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue