Annotation of embedaddon/php/ext/oci8/tests/pecl_bug8816.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: PECL Bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column)
3: --SKIPIF--
4: <?php
5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
6: require(dirname(__FILE__).'/skipif.inc');
7: ?>
8: --FILE--
9: <?php
10:
11: require dirname(__FILE__)."/connect.inc";
12:
13: $create_1 = "CREATE TABLE t1 (id INTEGER, l1 LONG)";
14: $create_2 = "CREATE TABLE t2 (id INTEGER, l2 LONG)";
15: $drop_1 = "DROP TABLE t1";
16: $drop_2 = "DROP TABLE t2";
17:
18: $s1 = oci_parse($c, $drop_1);
19: $s2 = oci_parse($c, $drop_2);
20: @oci_execute($s1);
21: @oci_execute($s2);
22:
23: $s1 = oci_parse($c, $create_1);
24: $s2 = oci_parse($c, $create_2);
25: oci_execute($s1);
26: oci_execute($s2);
27:
28: $values = array("1234567890111111111", "122222222222222", "985456745674567654567654567654", "123456789", "987654321");
29:
30: $i = 0;
31: foreach ($values as $val) {
32: $i++;
33: $insert = "INSERT INTO t1 VALUES($i, ".$val.")";
34: $s = oci_parse($c, $insert);
35: oci_execute($s);
36: }
37:
38: foreach ($values as $val) {
39: $insert = "INSERT INTO t2 VALUES($i, ".$val.")";
40: $s = oci_parse($c, $insert);
41: oci_execute($s);
42: $i--;
43: }
44:
45: $query ="
46: SELECT
47: t1.l1, t2.l2
48: FROM
49: t1, t2
50: WHERE
51: t1.id = t2.id
52: ORDER BY t1.id ASC
53: ";
54:
55: $sth = oci_parse($c, $query);
56: oci_execute($sth);
57:
58: while ( $row = oci_fetch_assoc($sth) ) {
59: var_dump($row);
60: }
61:
62: $s1 = oci_parse($c, $drop_1);
63: $s2 = oci_parse($c, $drop_2);
64: @oci_execute($s1);
65: @oci_execute($s2);
66:
67: echo "Done\n";
68:
69: ?>
70: --EXPECT--
71: array(2) {
72: ["L1"]=>
73: string(19) "1234567890111111111"
74: ["L2"]=>
75: string(9) "987654321"
76: }
77: array(2) {
78: ["L1"]=>
79: string(15) "122222222222222"
80: ["L2"]=>
81: string(9) "123456789"
82: }
83: array(2) {
84: ["L1"]=>
85: string(30) "985456745674567654567654567654"
86: ["L2"]=>
87: string(30) "985456745674567654567654567654"
88: }
89: array(2) {
90: ["L1"]=>
91: string(9) "123456789"
92: ["L2"]=>
93: string(15) "122222222222222"
94: }
95: array(2) {
96: ["L1"]=>
97: string(9) "987654321"
98: ["L2"]=>
99: string(19) "1234567890111111111"
100: }
101: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>