Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #11055 Using place-holders with := variable assignment fails
Submitted: 2007-05-16 06:07 UTC
From: bekarau Assigned: quipo
Status: Closed Package: MDB2_Driver_mysql (version 1.4.1)
PHP Version: 5.1.4 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2007-05-16 06:07 UTC] bekarau (Stuart J. Browne)
Description: ------------ When using a '?' place holder whilst also using a '@variable := value' assignment fails. After the := is encountered, nothing further is parsed correctly. There's two issues.. One is a simple fix, the other I'm not 100% sure about.. but it's working for me so far.. First is the _skipUserDefinedVariable()'s regular expression doesn't like the space between the @variable and the :=. No bigge, a '\s*' takes care of that. The other.. Test script: --------------- require_once('MDB2.php'); $_DB_DSN = "mysql://<user>:<pass>@localhost/test"; $_DBH =& MDB2::singleton($_DB_DSN); $_DBH->_getServerCapabilities(); $sql = "select @count := ?, @count"; $stmt =& $_DBH->prepare($sql); if (PEAR::isError($stmt)) { print "stmt: " . $stmt->getMessage() . "\n"; exit(2); } $resu = $stmt->execute(Array(5)); if (PEAR::isError($resu)) { print "resu: " . $resu->getMessage() . "\n"; exit(2); } print_r($resu->fetchRow(); Expected result: ---------------- Array ( [0] => 5 [1] => 5 ) Actual result: -------------- ... [4] => execute: [Error message: Binding Values failed with message: MDB2 Error: not found] [Last executed query: PREPARE MDB2_STATEMENT_mysql_d0c4bd4563e6f4185c6c793218b2ce66 FROM 'select @count := ?, @count'] [Native code: 0] ...

Comments

 [2007-05-19 16:43 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.