#42935 [Opn->Fbk]: pdo error handler is broken

From: Date: Tue, 21 Oct 2008 11:36:07 +0000
Subject: #42935 [Opn->Fbk]: pdo error handler is broken
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129944@lists.php.net to get a copy of this message
 ID:               42935
 Updated by:       jani@php.net
 Reported By:      denis at mesoconcepts dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         PDO related
 Operating System: freebsd
 PHP Version:      5.2.4
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[2007-10-11 21:36:17] denis at mesoconcepts dot com

pdo should generate an error when it cannot assign a type for a
prepared statement

------------------------------------------------------------------------

[2007-10-11 21:29:53] denis at mesoconcepts dot com

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.

------------------------------------------------------------------------

[2007-10-11 21:23:12] denis at mesoconcepts dot com

was of course meant: when something is __not__ null

------------------------------------------------------------------------

[2007-10-11 21:20:53] 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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42935&edit=1



Thread (5 messages)

« previous php.bugs (#129944) next »