mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +09:00
Fix inappropriate quoting of "distinct" in XML query
https://rhymix.org/qna/1914711
This commit is contained in:
parent
6917a76726
commit
e7d14be6bb
3 changed files with 23 additions and 3 deletions
|
|
@ -738,10 +738,11 @@ class Query extends VariableBase
|
|||
*/
|
||||
public static function quoteName(string $column_name): string
|
||||
{
|
||||
return preg_replace_callback('/[a-z][a-z0-9_.*]*(?!\\()\b/i', function($m) {
|
||||
$exceptions = ['*' => true, 'DISTINCT' => true, 'distinct' => true];
|
||||
return preg_replace_callback('/[a-z][a-z0-9_.*]*(?!\\()\b/i', function($m) use($exceptions) {
|
||||
$columns = explode('.', $m[0]);
|
||||
$columns = array_map(function($str) {
|
||||
return $str === '*' ? $str : ('`' . $str . '`');
|
||||
$columns = array_map(function($str) use($exceptions) {
|
||||
return isset($exceptions[$str]) ? $str : ('`' . $str . '`');
|
||||
}, $columns);
|
||||
return implode('.', $columns);
|
||||
}, $column_name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue