|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-08-19 12:33 UTC] deepdiver at owncloud dot com
Description:
------------
Query parameters are always bound to the value of the last parameter.
See the test script below.
Here is the out come with php 5.6:
$ php test.php
XDebug could not open the remote debug file '/tmp/xdebug.log'.
array(1) {
[0] =>
array(3) {
'A' =>
string(1) "1"
'B' =>
string(1) "2"
'C' =>
string(1) "3"
}
}
With 7.0.0beta3:
$ php --version
PHP 7.0.0beta3 (cli) (built: Aug 17 2015 17:19:56)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
deepdiver@alien:~/Development/ownCloud/php7-mysql$ php test.php
array(1) {
[0]=>
array(3) {
["A"]=>
string(1) "3"
["B"]=>
string(1) "3"
["C"]=>
string(1) "3"
}
}
Test script:
---------------
<?php
require 'vendor/autoload.php';
$config = new \Doctrine\DBAL\Configuration();
//..
$connectionParams = array(
'dbname' => 'XE',
'user' => 'autotest',
'password' => 'owncloud',
'host' => '10.0.0.7',
'port' => 1521,
'driver' => 'oci8',
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
$conn->connect();
$conn->executeUpdate('DROP TABLE TEST');
$conn->executeUpdate('CREATE TABLE TEST(A VARCHAR2(4000) NOT NULL, B VARCHAR2(4000) NOT NULL, C VARCHAR2(4000) NOT NULL)');
$conn->insert('TEST', [
'A' => '1',
'B' => '2',
'C' => '3']);
$all = $conn->fetchAll('select * from TEST');
var_dump($all);
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 23:00:02 2025 UTC |
Here is a pure OCI based script - which works \o/ - maybe a doctrine error then .... <?php function e($e) { if (!$e) { $e = oci_error(); var_dump($e); exit; } } $conn = oci_connect('autotest', 'owncloud', '172.17.0.1/XE'); e($conn); // drop table $stid = oci_parse($conn, 'DROP TABLE TEST'); e($stid); $r = oci_execute($stid); e($r); // create $stid = oci_parse($conn, 'CREATE TABLE TEST(A VARCHAR2(4000) NOT NULL, B VARCHAR2(4000) NOT NULL, C VARCHAR2(4000) NOT NULL)'); e($stid); $r = oci_execute($stid); e($r); // insert $stid = oci_parse($conn, 'INSERT INTO TEST (A, B, C) VALUES(:a, :b, :c)'); e($stid); $a = 1; $b = 2; $c = 3; oci_bind_by_name($stid, ':a', $a); oci_bind_by_name($stid, ':b', $b); oci_bind_by_name($stid, ':c', $c); $r = oci_execute($stid); // executes and commits e($r); // select $stid = oci_parse($conn, 'SELECT * FROM TEST'); e($stid); $r = oci_execute($stid); // executes and commits e($r); $data = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS); var_dump($data);