ID: 35919 Updated by: [EMAIL PROTECTED] Reported By: atixier at france-loisirs dot com -Status: Closed +Status: Bogus Bug Type: PDO related Operating System: AIX 4.3.3 PHP Version: 5CVS-2006-01-06 (snap) Assigned To: wez
Previous Comments: ------------------------------------------------------------------------ [2006-04-11 06:17:37] atixier at france-loisirs dot com Thanks for your help. This last point is now clear. ------------------------------------------------------------------------ [2006-04-10 15:22:21] [EMAIL PROTECTED] $stmt->execute(array("053", "to_date('20050222','YYYYMMDD')","XYZ")); This will never work. Binding doesn't mean "change '?' to what I say", it's more sophisticated. You can only pass values there, expressions like this are not allowed. ------------------------------------------------------------------------ [2006-04-10 15:04:38] atixier at france-loisirs dot com I installed the lastest CVS: php5.1-200604101230 With the firt sequence (please refer to my first mail): $stmt=$dbh->prepare("insert into R_QQQ (QUANTIEME,DH_FIN,RUN) values (?,?)"); $stmt->execute(array("ZYX", "053")); ==> Everything is OK With the second one (insert a date with "to_date" format): $stmt=$dbh->prepare("insert into R_QQQ (QUANTIEME,DH_FIN,RUN) values (?,?,?)"); $stmt->execute(array("053", "to_date('20050222','YYYYMMDD')","XYZ")); I get the following result: SQLSTATE[HY000]: General error: 1858 OCIStmtExecute: ORA-01858: a non-numeric character was found where a numeric was expected (/prod/outils/php5.1-200604101230/ext/pdo_oci/oci_statement.c:142) BUT, everything is OK, if I changed the "to_date" Oracle function in array by: $stmt=$dbh->prepare("insert into R_QQQ (QUANTIEME,DH_FIN,RUN) values (?,?,?)"); $stmt->execute(array("053", "22-FEB-2005","XYZ")); ------------------------------------------------------------------------ [2006-04-09 07:45:16] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip ------------------------------------------------------------------------ [2006-01-19 11:57:11] tommys at da2 dot so-net dot ne dot jp PHP 5.1.2 with Oracle 10gR1: $id = 123; $name = 'foo'; $stmt = $dbh->prepare("select ?,? from dual"); $stmt->execute(array($id, $name)); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { print_r($row); } Output: Array ( [:PDO1] => foo [:PDO2] => foo ) With bindValue(): $stmt->bindValue(1, $id); $stmt->bindValue(2, $name); $stmt->execute(); is same result. With named placeholders: $stmt = $dbh->prepare("select :id, :name from dual"); $stmt->bindValue(':id', $id); $stmt->bindValue(':name', $name); $stmt->execute(); Output: Array ( [:ID] => foo [:NAME] => foo ) With bindParam(): $stmt = $dbh->prepare("select :id, :name from dual"); $stmt->bindParam(':id', $id); $stmt->bindParam(':name', $name); $stmt->execute(); Array ( [:ID] => -1.990921021434 [:NAME] => -1.990921021434 ) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/35919 -- Edit this bug report at http://bugs.php.net/?id=35919&edit=1