|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-03-06 14:44 UTC] developit at mail dot ru
[2006-03-06 14:48 UTC] tony2001@php.net
[2016-03-08 01:40 UTC] sixd@php.net
-Package: PDO related
+Package: PDO OCI
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
Description: ------------ I have a problem in PDO extension (PDO_OCI driver) when I use 'insert' statement with the named placeholders. I insert two different strings into two fields. Execution of 'select' statement returns one the same 'word' in two fields. Similar problem I'h found in 'Select' statement with the named placeholders. This 'bug' occured in PHP version greater then 5.1.0RC7-dev (snapshot 2005-11-21 07:30), where all works correctly. In versions 5.1.1, 5.1.2 and the latest (php5.1 2006-03-03 09:30) I have above errors. I use --with-pdo-oci=instantclient,/usr,10.1.0.3 switch during compilation and I connect with Oracle server in 8.1.7 version. I run this test case under PDO_PGSQL driver and it works properly. Reproduce code: --------------- $x = new PDO("oci:dbname=xxx", 'scott', 'tiger'); $x->query("CREATE TABLE test(name VARCHAR2(100), value VARCHAR2(100))"); //insert statement: $stmt = $x->prepare("INSERT INTO test (name, value) VALUES (:name, :value)"); $t = array(":name"=>"foo",":value"=>"bar"); $stmt->execute($t); //test select statement: $row = $x->query("SELECT name, value FROM test"); print("name: ".$row["NAME"]." value:".$row["VALUE"]); //'bindParam' version of 'insert' statement: $stmt = $x->prepare("INSERT INTO test (name, value) VALUES (:name, :value)"); $stmt->bindParam(":name", $the_name, PDO::PARAM_STR, 32); $stmt->bindParam(":value", $the_value, PDO::PARAM_STR, 32); $the_name = "foo"; $the_value = "bar"; $stmt->execute(); //select statement: $stmt = $x->prepare("SELECT name, value FROM test WHERE name = :name AND value = :value"); $the_name = 'foo'; $the_value = 'bar'; $stmt->execute(array(":name"=>$the_name,":value"=>$the_value)); if($row = $stmt->fetch()) print_r($row); else print "no rows"; if($row["NAME"]!=$the_name or $row["VALUE"]!=$the_value) { print("Error: selected value is different from condition"); } else { print("OK"); } Expected result: ---------------- name: foo value: bar Array ( [NAME] => foo [0] => foo [VALUE] => bar [1] => bar ) OK Actual result: -------------- name: bar value: bar "Segmentation fault" error Array ( [NAME] => bar [0] => bar [VALUE] => bar [1] => bar ) Error: selected value is different from condition