From 5496180b4727ac0e8bd0de284a090396d29f9237 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 7 Jul 2020 14:03:06 +0900 Subject: [PATCH] Fix handling of empty string arguments in write queries --- common/framework/db.php | 1 + .../parsers/dbquery/variablebase.php | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/common/framework/db.php b/common/framework/db.php index adaab6483..f7a96a1c3 100644 --- a/common/framework/db.php +++ b/common/framework/db.php @@ -344,6 +344,7 @@ class DB { $output = $this->setError(-1, $e->getMessage()); $output->add('_query', $query_string); + $output->add('_args', $query_params); $output->add('_elapsed_time', '0.00000'); $output->page_navigation = new \PageHandler(0, 0, 0); $this->_query_id = ''; diff --git a/common/framework/parsers/dbquery/variablebase.php b/common/framework/parsers/dbquery/variablebase.php index d3e49b37b..002769d19 100644 --- a/common/framework/parsers/dbquery/variablebase.php +++ b/common/framework/parsers/dbquery/variablebase.php @@ -50,7 +50,15 @@ class VariableBase elseif ($args[$this->var] === '') { $this->filterValue($args[$this->var]); - list($is_expression, $value) = $this->getDefaultValue(); + if ($this instanceof ColumnWrite) + { + $value = $args[$this->var]; + $is_expression = false; + } + else + { + list($is_expression, $value) = $this->getDefaultValue(); + } } else { @@ -281,7 +289,15 @@ class VariableBase { if ($args[$this->var] === '') { - list($is_expression, $value) = $this->getDefaultValue(); + if ($this instanceof ColumnWrite) + { + $value = $args[$this->var]; + $is_expression = false; + } + else + { + list($is_expression, $value) = $this->getDefaultValue(); + } } else {