Commit 566ed3c5 by Qiang Xue

Fixes #5147: null is not handled correctly for arbitrary operator in SQL.

parent 4772be9c
...@@ -1236,9 +1236,12 @@ class QueryBuilder extends \yii\base\Object ...@@ -1236,9 +1236,12 @@ class QueryBuilder extends \yii\base\Object
$column = $this->db->quoteColumnName($column); $column = $this->db->quoteColumnName($column);
} }
$phName = self::PARAM_PREFIX . count($params); if ($value === null) {
$params[$phName] = $value === null ? 'NULL' : $value; return "$column $operator NULL";
} else {
return "$column $operator $phName"; $phName = self::PARAM_PREFIX . count($params);
$params[$phName] = $value;
return "$column $operator $phName";
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment