$PASSWD = 'ibmdb2';
$DBNAME = 'SAMPLE';
-$CONNECTION = "odbc:$DBNAME";
+$CONNECTION = "odbc:DSN=$DBNAME;UID=$USER;PWD=$PASSWD;";
$PDO_TESTS = dirname(__FILE__) . '/../../pdo/tests/';
--- /dev/null
+--TEST--
+PDO_ODBC: PDO_FETCH_BOUND
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
+
+require_once($PDO_TESTS . 'pdo_016.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===INIT===
+int(1)
+int(1)
+int(1)
+string(1) "3"
+array(3) {
+ [0]=>
+ string(7) "String0"
+ [1]=>
+ string(7) "String1"
+ [2]=>
+ string(7) "String2"
+}
+===WHILE===
+array(1) {
+ [0]=>
+ string(7) "String0"
+}
+array(1) {
+ [1]=>
+ string(7) "String1"
+}
+array(1) {
+ [2]=>
+ string(7) "String2"
+}
+===ALONE===
+array(1) {
+ [0]=>
+ string(7) "String0"
+}
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+array(1) {
+ [0]=>
+ string(7) "String0"
+}
+array(1) {
+ [1]=>
+ string(7) "String1"
+}
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+array(1) {
+ [1]=>
+ string(7) "String1"
+}
+array(1) {
+ [2]=>
+ string(7) "String2"
+}
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+array(1) {
+ [2]=>
+ string(7) "String2"
+}
+===REBIND/SAME===
+array(1) {
+ [0]=>
+ string(7) "String0"
+}
+bool(true)
+bool(true)
+string(7) "String0"
+bool(true)
+bool(true)
+string(1) "0"
+array(1) {
+ [1]=>
+ string(7) "String1"
+}
+bool(true)
+bool(true)
+string(7) "String1"
+bool(true)
+bool(true)
+string(1) "1"
+array(1) {
+ [2]=>
+ string(7) "String2"
+}
+bool(true)
+bool(true)
+string(7) "String2"
+bool(true)
+bool(true)
+string(1) "2"
+===REBIND/CONFLICT===
+string(7) "String0"
+string(7) "String1"
+string(7) "String2"
+===DONE===
--- /dev/null
+--TEST--
+PDO_ODBC: PDO Unserializing
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc');
+if (!interface_exists('Serializable')) die ('skip Interface Serializable does not exist');
+?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+$SQL = array(
+ 'create1'=>'CREATE TABLE classtypes(id INT NOT NULL PRIMARY KEY, name VARCHAR(20) NOT NULL UNIQUE)',
+);
+
+$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
+
+require_once($PDO_TESTS . 'pdo_018.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===INIT===
+int(1)
+int(1)
+int(1)
+string(1) "3"
+array(3) {
+ [0]=>
+ string(8) "stdClass"
+ [1]=>
+ string(8) "TestBase"
+ [2]=>
+ string(11) "TestDerived"
+}
+===TYPES===
+array(4) {
+ ["stdClass"]=>
+ string(1) "0"
+ ["TestBase"]=>
+ string(1) "1"
+ ["TestDerived"]=>
+ string(1) "2"
+ ["TestLeaf"]=>
+ NULL
+}
+===INSERT===
+TestBase::serialize() = 'a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}'
+TestDerived::serialize()
+TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
+TestDerived::serialize()
+TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
+===DATA===
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
+ [2]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ [3]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+}
+===FAILURE===
+Exception:SQLSTATE[HY000]: General error: cannot unserialize class
+===COUNT===
+string(1) "3"
+===DATABASE===
+array(3) {
+ [0]=>
+ array(2) {
+ ["NAME"]=>
+ string(8) "TestBase"
+ ["VAL"]=>
+ string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
+ }
+ [1]=>
+ array(2) {
+ ["NAME"]=>
+ string(11) "TestDerived"
+ ["VAL"]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ }
+ [2]=>
+ array(2) {
+ ["NAME"]=>
+ NULL
+ ["VAL"]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ }
+}
+===FETCHCLASS===
+TestBase::unserialize[22](a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";})
+TestDerived::unserialize()
+TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
+TestDerived::unserialize()
+TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
+array(3) {
+ [0]=>
+ object(TestBase)#%d (3) {
+ ["BasePub"]=>
+ string(7) "#Public"
+ ["BasePro:protected"]=>
+ string(10) "#Protected"
+ ["BasePri:private"]=>
+ string(8) "#Private"
+ }
+ [1]=>
+ object(TestDerived)#%d (6) {
+ ["BasePub"]=>
+ string(14) "#DerivedPublic"
+ ["BasePro:protected"]=>
+ string(17) "#DerivdeProtected"
+ ["DerivedPub"]=>
+ string(7) "#Public"
+ ["DerivedPro:protected"]=>
+ string(10) "#Protected"
+ ["DerivedPri:private"]=>
+ string(7) "Private"
+ ["BasePri:private"]=>
+ string(7) "Private"
+ }
+ [2]=>
+ object(TestLeaf)#%d (6) {
+ ["BasePub"]=>
+ string(14) "#DerivedPublic"
+ ["BasePro:protected"]=>
+ string(17) "#DerivdeProtected"
+ ["DerivedPub"]=>
+ string(7) "#Public"
+ ["DerivedPro:protected"]=>
+ string(10) "#Protected"
+ ["DerivedPri:private"]=>
+ string(7) "Private"
+ ["BasePri:private"]=>
+ string(7) "Private"
+ }
+}
+===DONE===
--- /dev/null
+--TEST--
+PDO_ODBC: fetch() and while()
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
+
+require_once($PDO_TESTS . 'pdo_019.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===INIT===
+int(1)
+int(1)
+int(1)
+int(1)
+string(1) "4"
+array(4) {
+ [0]=>
+ string(7) "String0"
+ [1]=>
+ string(7) "String1"
+ [2]=>
+ string(7) "String2"
+ [3]=>
+ string(7) "String3"
+}
+===WHILE===
+array(1) {
+ [0]=>
+ string(7) "String0"
+}
+array(1) {
+ [1]=>
+ string(7) "String1"
+}
+array(1) {
+ [2]=>
+ string(7) "String2"
+}
+array(1) {
+ [3]=>
+ string(7) "String3"
+}
+===DONE===
--- /dev/null
+--TEST--
+PDO_ODBC: Overloading
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+require_once($PDO_TESTS . 'pdo_023_def.inc');
+
+$DB = NULL;
+
+$DB = new PDODatabaseX($CONNECTION, $USER, $PASSWD);
+$DB->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_WARNING);
+
+require_once($PDO_TESTS . 'pdo_023.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+int(1)
+int(2)
+object(PDODatabaseX)#%d (2) {
+ ["test1"]=>
+ int(1)
+ ["test2"]=>
+ int(22)
+}
+PDODatabaseX::query()
+PDOStatementX::__construct()
+PDOStatementX::__destruct()
+PDODatabaseX::query()
+PDOStatementX::__construct()
+PDOStatementX::__destruct()
+PDODatabaseX::query()
+PDOStatementX::__construct()
+PDOStatementX::__destruct()
+PDODatabaseX::query()
+PDOStatementX::__construct()
+object(PDOStatementX)#%d (3) {
+ ["test1"]=>
+ int(1)
+ ["queryString"]=>
+ string(24) "SELECT val, id FROM test"
+ ["test2"]=>
+ int(22)
+}
+array(2) {
+ ["A"]=>
+ string(1) "0"
+ ["B"]=>
+ string(1) "1"
+}
+PDOStatementX::__destruct()
+PDODatabaseX::__destruct()
+===DONE===
--- /dev/null
+--TEST--
+PDO_ODBC: Bind does not convert NULL
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+$SQL['create'] = 'CREATE TABLE test(id INT, val VARCHAR(10))';
+
+$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
+
+require_once($PDO_TESTS . 'pdo_024.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+bind: success
+bool(true)
+NULL
+===DONE===
--- /dev/null
+--TEST--
+PDO_ODBC: PDO_FETCH_INTO
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+$DB->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
+
+require_once($PDO_TESTS . 'pdo_025.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+object(Test)#%d (3) {
+ ["id"]=>
+ string(2) "10"
+ ["val"]=>
+ string(3) "Abc"
+ ["val2"]=>
+ string(3) "zxy"
+}
+object(Test)#%d (3) {
+ ["id"]=>
+ string(2) "20"
+ ["val"]=>
+ string(3) "Def"
+ ["val2"]=>
+ string(3) "wvu"
+}
+object(Test)#%d (3) {
+ ["id"]=>
+ string(2) "30"
+ ["val"]=>
+ string(3) "Ghi"
+ ["val2"]=>
+ string(3) "tsr"
+}
+object(Test)#%d (3) {
+ ["id"]=>
+ string(2) "40"
+ ["val"]=>
+ string(3) "Jkl"
+ ["val2"]=>
+ string(3) "qpo"
+}
+object(Test)#%d (3) {
+ ["id"]=>
+ string(2) "50"
+ ["val"]=>
+ string(3) "Mno"
+ ["val2"]=>
+ string(3) "nml"
+}
+object(Test)#%d (3) {
+ ["id"]=>
+ string(2) "60"
+ ["val"]=>
+ string(3) "Pqr"
+ ["val2"]=>
+ string(3) "kji"
+}
+===FAIL===
+
+Fatal error: Cannot access protected property Fail::$id in %spdo_025.inc on line %d
--- /dev/null
+--TEST--
+PDO_ODBC: Deriving PDO
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+require_once($PDO_TESTS . 'pdo_026.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+string(11) "PDODatabase"
+string(12) "PDOStatement"
+PDODatabase::query()
+PDOStatementX::__construct()
+string(13) "PDOStatementX"
+string(11) "PDODatabase"
+array(3) {
+ ["ID"]=>
+ string(2) "10"
+ ["VAL"]=>
+ string(3) "Abc"
+ ["VAL2"]=>
+ string(3) "zxy"
+}
+array(3) {
+ ["ID"]=>
+ string(2) "20"
+ ["VAL"]=>
+ string(3) "Def"
+ ["VAL2"]=>
+ string(3) "wvu"
+}
+array(3) {
+ ["ID"]=>
+ string(2) "30"
+ ["VAL"]=>
+ string(3) "Ghi"
+ ["VAL2"]=>
+ string(3) "tsr"
+}
+===DONE===
+PDODatabase::__destruct()
+PDOStatementX::__destruct()
'create'=>'CREATE TABLE test(id int NOT NULL PRIMARY KEY, val VARCHAR(10))'
);
-$DB = new pdo($CONNECTION, $USER, $PASSWD);
+//$DB = new pdo($CONNECTION, $USER, $PASSWD);
+$DB = new pdo($CONNECTION);
foreach(array('test','classtypes') as $name)
{