I can't find any info on this.
In mysql I'd write
select id, fax from addresses where isnull(fax);
I'm trying this:
$val = NULL;
$stmt = $pdo->prepare("select id, fax from addresses where fax =:fax");
$stmt->bindParam(':fax', $val, PDO::PARAM_NULL);
assert($stmt->execute());
print_r($stmt->fetchAll(PDO::FETCH_ASSOC));
// result: no records found which is not correct, there are many
changing the prepare method call to this works:
$stmt = $pdo->prepare("select id, fax from addresses where isnull(fax)");
But I'm thinking about a db-vendor agnostic approach, which is why we use PDO in the first place, right?. In ANSI SQL isnull() is not the same as mysql isnull() as far as I can tell.
How can I use PDO to find records where a particular field is NULL in a manner that is portable across database vendors (mysql, postgres, mssql, etc)? I don't know if this is even possible.