]> granicus.if.org Git - php/commitdiff
Next batch of tests for PDO_ODBC (tested against DB2 V8.2).
authorDan Scott <dbs@php.net>
Thu, 3 Mar 2005 13:53:55 +0000 (13:53 +0000)
committerDan Scott <dbs@php.net>
Thu, 3 Mar 2005 13:53:55 +0000 (13:53 +0000)
ext/pdo_odbc/tests/pdo_006.phpt [new file with mode: 0755]
ext/pdo_odbc/tests/pdo_007.phpt [new file with mode: 0755]
ext/pdo_odbc/tests/pdo_008.phpt [new file with mode: 0755]
ext/pdo_odbc/tests/pdo_009.phpt [new file with mode: 0755]

diff --git a/ext/pdo_odbc/tests/pdo_006.phpt b/ext/pdo_odbc/tests/pdo_006.phpt
new file mode 100755 (executable)
index 0000000..5cb31fe
--- /dev/null
@@ -0,0 +1,64 @@
+--TEST--
+PDO_ODBC: PDO_FETCH_GROUP
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+require_once($PDO_TESTS . 'pdo_006.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+array(2) {
+  ["A"]=>
+  array(2) {
+    [0]=>
+    array(1) {
+      [0]=>
+      string(1) "1"
+    }
+    [1]=>
+    array(1) {
+      [0]=>
+      string(1) "2"
+    }
+  }
+  ["C"]=>
+  array(1) {
+    [0]=>
+    array(1) {
+      [0]=>
+      string(1) "3"
+    }
+  }
+}
+array(2) {
+  ["A"]=>
+  array(2) {
+    [0]=>
+    array(1) {
+      ["ID"]=>
+      string(1) "1"
+    }
+    [1]=>
+    array(1) {
+      ["ID"]=>
+      string(1) "2"
+    }
+  }
+  ["C"]=>
+  array(1) {
+    [0]=>
+    array(1) {
+      ["ID"]=>
+      string(1) "3"
+    }
+  }
+}
+===DONE===
diff --git a/ext/pdo_odbc/tests/pdo_007.phpt b/ext/pdo_odbc/tests/pdo_007.phpt
new file mode 100755 (executable)
index 0000000..0412b97
--- /dev/null
@@ -0,0 +1,54 @@
+--TEST--
+PDO_ODBC: PDO_FETCH_UNIQUE
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+$SQL = array('create'=>'CREATE TABLE test(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))');
+
+require_once($PDO_TESTS . 'pdo_007.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+array(3) {
+  ["A"]=>
+  array(1) {
+    [0]=>
+    string(1) "A"
+  }
+  ["B"]=>
+  array(1) {
+    [0]=>
+    string(1) "A"
+  }
+  ["C"]=>
+  array(1) {
+    [0]=>
+    string(1) "C"
+  }
+}
+array(3) {
+  ["A"]=>
+  array(1) {
+    ["VAL"]=>
+    string(1) "A"
+  }
+  ["B"]=>
+  array(1) {
+    ["VAL"]=>
+    string(1) "A"
+  }
+  ["C"]=>
+  array(1) {
+    ["VAL"]=>
+    string(1) "C"
+  }
+}
+===DONE===
diff --git a/ext/pdo_odbc/tests/pdo_008.phpt b/ext/pdo_odbc/tests/pdo_008.phpt
new file mode 100755 (executable)
index 0000000..d1b3508
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+PDO_ODBC: PDO_FETCH_UNIQUE conflict
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+$SQL = array('create'=>'CREATE TABLE test(id CHAR(1) NOT NULL PRIMARY KEY, val VARCHAR(10))');
+
+require_once($PDO_TESTS . 'pdo_008.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+array(2) {
+  ["A"]=>
+  array(1) {
+    [0]=>
+    string(1) "B"
+  }
+  ["C"]=>
+  array(1) {
+    [0]=>
+    string(1) "C"
+  }
+}
+===DONE===
diff --git a/ext/pdo_odbc/tests/pdo_009.phpt b/ext/pdo_odbc/tests/pdo_009.phpt
new file mode 100755 (executable)
index 0000000..291b1e8
--- /dev/null
@@ -0,0 +1,94 @@
+--TEST--
+PDO_ODBC: PDO_FETCH_CLASSTYPE
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+$SQL = array (
+       'create1'=>'CREATE TABLE classtypes(id INT NOT NULL PRIMARY KEY, name VARCHAR(10) NOT NULL UNIQUE)',
+       'create2'=>'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, classtype INT, val VARCHAR(10))'
+);
+
+require_once($PDO_TESTS . 'pdo_009.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+array(4) {
+  [0]=>
+  array(3) {
+    [0]=>
+    string(8) "stdClass"
+    [1]=>
+    string(1) "1"
+    [2]=>
+    string(1) "A"
+  }
+  [1]=>
+  array(3) {
+    [0]=>
+    string(5) "Test1"
+    [1]=>
+    string(1) "2"
+    [2]=>
+    string(1) "B"
+  }
+  [2]=>
+  array(3) {
+    [0]=>
+    string(5) "Test2"
+    [1]=>
+    string(1) "3"
+    [2]=>
+    string(1) "C"
+  }
+  [3]=>
+  array(3) {
+    [0]=>
+    NULL
+    [1]=>
+    string(1) "4"
+    [2]=>
+    string(1) "D"
+  }
+}
+Test1::__construct()
+Test2::__construct()
+Test3::__construct()
+array(4) {
+  [0]=>
+  object(stdClass)#%d (2) {
+    ["ID"]=>
+    string(1) "1"
+    ["VAL"]=>
+    string(1) "A"
+  }
+  [1]=>
+  object(Test1)#%d (2) {
+    ["ID"]=>
+    string(1) "2"
+    ["VAL"]=>
+    string(1) "B"
+  }
+  [2]=>
+  object(Test2)#%d (2) {
+    ["ID"]=>
+    string(1) "3"
+    ["VAL"]=>
+    string(1) "C"
+  }
+  [3]=>
+  object(Test3)#%d (2) {
+    ["ID"]=>
+    string(1) "4"
+    ["VAL"]=>
+    string(1) "D"
+  }
+}
+===DONE===