I want to use queries like that:
$sql = "SELECT `name` FROM `table` WHERE `id` IN (?)";
and bind array of values
$sth = $pdo->prepare($sql);
$sth->execute(array(array('1', '2', '4')));
So, I must wrap PDO. How to implement this behavior and consider all it pitfalls?
It must consider:
IN(?) with array values;
IN(?) with empty array;
NOT IN(?) with array values;
NOT IN(?) with empty array;
NOT (expr IN (?)) with array values;
NOT (expr IN (?)) with empty.
The problem becomes what we have an empty array. with simple in i can replace in this situation wildcard to null. But what i must to do if i have NOT IN(?) and empty array?
The hot point is using NOT IN (?)
with empty array.