Fix handling of empty string arguments in write queries

This commit is contained in:
Kijin Sung 2020-07-07 14:03:06 +09:00
parent 5dc1eb0762
commit 5496180b47
2 changed files with 19 additions and 2 deletions

View file

@ -344,6 +344,7 @@ class DB
{ {
$output = $this->setError(-1, $e->getMessage()); $output = $this->setError(-1, $e->getMessage());
$output->add('_query', $query_string); $output->add('_query', $query_string);
$output->add('_args', $query_params);
$output->add('_elapsed_time', '0.00000'); $output->add('_elapsed_time', '0.00000');
$output->page_navigation = new \PageHandler(0, 0, 0); $output->page_navigation = new \PageHandler(0, 0, 0);
$this->_query_id = ''; $this->_query_id = '';

View file

@ -50,8 +50,16 @@ class VariableBase
elseif ($args[$this->var] === '') elseif ($args[$this->var] === '')
{ {
$this->filterValue($args[$this->var]); $this->filterValue($args[$this->var]);
if ($this instanceof ColumnWrite)
{
$value = $args[$this->var];
$is_expression = false;
}
else
{
list($is_expression, $value) = $this->getDefaultValue(); list($is_expression, $value) = $this->getDefaultValue();
} }
}
else else
{ {
$this->filterValue($args[$this->var]); $this->filterValue($args[$this->var]);
@ -280,9 +288,17 @@ class VariableBase
if ($this->var && Query::isValidVariable($args[$this->var], $this instanceof ColumnWrite)) if ($this->var && Query::isValidVariable($args[$this->var], $this instanceof ColumnWrite))
{ {
if ($args[$this->var] === '') if ($args[$this->var] === '')
{
if ($this instanceof ColumnWrite)
{
$value = $args[$this->var];
$is_expression = false;
}
else
{ {
list($is_expression, $value) = $this->getDefaultValue(); list($is_expression, $value) = $this->getDefaultValue();
} }
}
else else
{ {
$is_expression = false; $is_expression = false;