Forwarding here.
Maybe it got lost inbetween the spam attacks, maybe its just not
interesting but lets open up the topic to a larger audience :)
-------- Original Message --------
Subject: fetch() returning false for empty datasets
Date: Mon, 05 Jun 2006 11:41:12 +0200
From: lsmith@php.net (Lukas Smith)
To: pecl-dev@lists.php.net
Newsgroups: php.pecl.dev
Hi,
the following script outputs "false" (at least on whatever pdo version
is bundled with 5.1.4):
$sql = 'SELECT 1 FROM dual WHERE 1=0';
$stmt = $dbh->query($sql);
var_dump($stmt->fetch(PDO::FETCH_ASSOC));
all other RDBMS extension we have return null in this case, which seems
to be the right thing too ..
regards,
Lukas
Forwarding here.
Maybe it got lost inbetween the spam attacks, maybe its just not
interesting but lets open up the topic to a larger audience :)-------- Original Message --------
Subject: fetch() returning false for empty datasets
Date: Mon, 05 Jun 2006 11:41:12 +0200
From: lsmith@php.net (Lukas Smith)
To: pecl-dev@lists.php.net
Newsgroups: php.pecl.devHi,
the following script outputs "false" (at least on whatever pdo version
is bundled with 5.1.4):$sql = 'SELECT 1 FROM dual WHERE 1=0';
$stmt = $dbh->query($sql);
var_dump($stmt->fetch(PDO::FETCH_ASSOC));all other RDBMS extension we have return null in this case, which seems
to be the right thing too ..
I have to agree here. NULL
defines this situation perfectly, false
being used for errors (strict false, === FALSE).
--Pierre