here is a parameterized query:
SELECT
field1,field2,etc1,etc2
FROM my_table WHERE
conditionA=:conditionA AND
conditionB=:conditionB
and my parameters:
array( 'conditionA'=> 5, 'conditionB'=>NULL )
Now in this theoretical case, conditionB
could be a value OR it could be null. But in SQL, you do not say conditionB=NULL
- you write it "conditionB IS NULL
".
How am I supposed to do this? First of all, if I pass 'conditionB'=>NULL
in my params, then I'm assuming that node is simply not passed. Second, am I going to need to rewrite the query between "=" and "IS" based on the type value of conditionB
, or can PDO do this for me as well?