|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-10-11 21:20 UTC] denis at mesoconcepts dot com
Description:
------------
using select 1 where something is null returns an empty array
D.
Reproduce code:
---------------
try
{
$dbh =& new PDO(
'pgsql:host=' . $db_host . ';dbname=' . $db_name,
$db_user,
$db_pass
);
}
$dbs = $dbh->prepare("
SELECT 1
WHERE ? IS NOT NULL
");
$dbs->execute(array(1));
$res = $dbs->fetchAll();
var_dump($res);
Expected result:
----------------
a row
Actual result:
--------------
no rows
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 23:00:01 2025 UTC |
further investigation led us to identify this query as a solution: $dbs = $dbh->prepare(' SELECT 1 WHERE (?)::int4 IS NOT NULL '); nonetheless, it would be sweet if pdo identified the first as an integer indeed.