mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Fix #1422 incorrect quoting of expressions in XML queries
This commit is contained in:
parent
57b356f5fa
commit
28b3c2ef34
4 changed files with 35 additions and 9 deletions
|
|
@ -581,11 +581,13 @@ class Query extends VariableBase
|
|||
*/
|
||||
public static function quoteName(string $column_name): string
|
||||
{
|
||||
$columns = explode('.', $column_name);
|
||||
$columns = array_map(function($str) {
|
||||
return $str === '*' ? $str : ('`' . $str . '`');
|
||||
}, $columns);
|
||||
return implode('.', $columns);
|
||||
return preg_replace_callback('/[a-z][a-z0-9_.*]*(?!\\()\b/i', function($m) {
|
||||
$columns = explode('.', $m[0]);
|
||||
$columns = array_map(function($str) {
|
||||
return $str === '*' ? $str : ('`' . $str . '`');
|
||||
}, $columns);
|
||||
return implode('.', $columns);
|
||||
}, $column_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue