PROPERLY fix null value handling in both read and write queries

This commit is contained in:
Kijin Sung 2022-01-25 14:54:17 +09:00
parent 7f5f67992d
commit 7f6e020d97
6 changed files with 158 additions and 0 deletions

View file

@ -51,6 +51,17 @@ class VariableBase
$this->filterValue('');
$value = strval($args[$this->var]);
$is_expression = true;
if ($args[$this->var] instanceof NullValue)
{
if ($this->not_null)
{
throw new \Rhymix\Framework\Exceptions\QueryError('Variable ' . $this->var . ' for column ' . $this->column . ' must not be null');
}
if ($this instanceof Condition && in_array($this->operation, ['equal', 'notequal', 'not_equal']))
{
$this->operation = ($this->operation === 'equal') ? 'null' : 'notnull';
}
}
}
elseif ($args[$this->var] === '')
{