Nette\Database NOT IN ? with empty array

6 years ago

priman
Member | 7
+
0
-

Hello,

i found possible bug in select. Code for reproduction is:

$empty = array();
$connection->table("foo")->select("*")->where("(id NOT IN ?)",$empty);

Badly generated SQL is: SELECT * FROM foo WHERE ((id NOT IS NULL AND FALSE))

6 years ago

hrach
Member | 1818
+
0
-

@duke: what? I thing your code doesn't solve anything.

@priman: correct solution, but you probably know it and you are just reporting bug.

$connection->table("foo")->select("*")->where("(id NOT ?)", []);

6 years ago

duke
Member | 650
+
0
-

@hrach My bad. I thought @priman's use of brackets was different than Nette\Database requires and didn't notice it was the IN operator that confused it instead…

I am removing my previous comment.