Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
8cae0850
Commit
8cae0850
authored
Dec 12, 2017
by
Damyon Wiese
Browse files
Merge branch 'MDL-60976-master' of
https://github.com/matt-catalyst/moodle
parents
47864439
1c06098b
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/dml/moodle_database.php
View file @
8cae0850
...
...
@@ -2402,21 +2402,25 @@ abstract class moodle_database {
// Enclose the column name by the proper quotes if it's a reserved word.
$columnname
=
$this
->
get_manager
()
->
generator
->
getEncQuoted
(
$column
->
name
);
$searchsql
=
$this
->
sql_like
(
$columnname
,
'?'
);
$searchparam
=
'%'
.
$this
->
sql_like_escape
(
$search
)
.
'%'
;
$sql
=
"UPDATE
{
".$table."
}
SET
$columnname
= REPLACE(
$columnname
, ?, ?)
WHERE
$
columnname
IS NOT NULL
"
;
WHERE
$
searchsql
"
;
if
(
$column
->
meta_type
===
'X'
)
{
$this
->
execute
(
$sql
,
array
(
$search
,
$replace
));
$this
->
execute
(
$sql
,
array
(
$search
,
$replace
,
$searchparam
));
}
else
if
(
$column
->
meta_type
===
'C'
)
{
if
(
core_text
::
strlen
(
$search
)
<
core_text
::
strlen
(
$replace
))
{
$colsize
=
$column
->
max_length
;
$sql
=
"UPDATE
{
".$table."
}
SET
$columnname
= "
.
$this
->
sql_substr
(
"REPLACE("
.
$columnname
.
", ?, ?)"
,
1
,
$colsize
)
.
"
WHERE
$
columnname
IS NOT NULL
"
;
WHERE
$
searchsql
"
;
}
$this
->
execute
(
$sql
,
array
(
$search
,
$replace
));
$this
->
execute
(
$sql
,
array
(
$search
,
$replace
,
$searchparam
));
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment