#25311 [NEW]: DB_Common::prepare() returns 0

From: Date: Fri, 29 Aug 2003 12:20:06 +0000
Subject: #25311 [NEW]: DB_Common::prepare() returns 0
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-20817@lists.php.net to get a copy of this message
From: jamert at one dot lv Operating system: Red Hat Linux release 6.2 PHP version: 4.3.3 PHP Bug Type: PEAR related Bug description: DB_Common::prepare() returns 0 Description: ------------ Greetings! I have an interesting problem, using prepare() method of interface class DB_Common in package PEAR DB (last version, 1.5.0RC1). According to documentation, it must return resource, but it returns 0! So, I cannot use "execute()". There's no even error! Though, connection is established correctly, and the queries work properly, using such methods as query, getRow, etc. If I use query or get* methods as workaround, for example: $DB->query("SELECT type_name FROM FOO WHERE ?=?", array("type_id", 3)); , then everything goes fine. Reproduce code: --------------- <? require_once ("common/conf/config.inc.php"); // Here the $CONFIG array is defined require_once ("DB.php"); $db_host = $CONFIG['db']['host']; $db_type = $CONFIG['db']['dbtype']; $db_name = $CONFIG['db']['dbname']; $db_user = $CONFIG['db']['user']; $db_pwd = $CONFIG['db']['password']; $dsn = "$db_type://$db_user:$db_pwd@$db_host/$db_name"; $DB = DB::connect($dsn); if (DB::isError($DB)) die ($DB->getMessage()); $prep_stmt = $DB->prepare("SELECT type_name FROM FOO WHERE type_id=?"); if (DB::isError($DB)) die ($DB->getMessage()); // Just to be sure that PEAR still thinks that all is OK echo "PREPARED STATEMENT: '$prep_stmt', type is " . gettype($prep_stmt); ?> Expected result: ---------------- The query handle, of type 'resourse', according to documentation. (I don't know the right output text to be, just because I've never got one). Actual result: -------------- PREPARED STATEMENT: '0', type is integer -- Edit bug report at http://bugs.php.net/?id=25311&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25311&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25311&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25311&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25311&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25311&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25311&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25311&r=support Expected behavior: http://bugs.php.net/fix.php?id=25311&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25311&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25311&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25311&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25311&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25311&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25311&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25311&r=gnused

« previous php.pear.dev (#20817) next »