1--TEST-- 2SELECT tests with duplicate column anmes 3--SKIPIF-- 4<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> 5--FILE-- 6<?php 7 8require(dirname(__FILE__).'/connect.inc'); 9 10// Initialization 11 12$stmtarray = array( 13 "drop table dupcolnames_tab1", 14 "drop table dupcolnames_tab2", 15 16 "create table dupcolnames_tab1 (c1 number, dupnamecol varchar2(20))", 17 "create table dupcolnames_tab2 (c2 number, dupnamecol varchar2(20))", 18 19 "insert into dupcolnames_tab1 (c1, dupnamecol) values (1, 'chris')", 20 "insert into dupcolnames_tab2 (c2, dupnamecol) values (2, 'jones')", 21); 22 23oci8_test_sql_execute($c, $stmtarray); 24 25// Run Test 26 27echo "Test 1 - OCI_ASSOC\n"; 28$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2"); 29oci_execute($s); 30while (($r = oci_fetch_array($s, OCI_ASSOC)) != false) { 31 var_dump($r); 32} 33 34 35echo "\nTest 2 - OCI_NUM\n"; 36$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2"); 37oci_execute($s); 38while (($r = oci_fetch_array($s, OCI_NUM)) != false) { 39 var_dump($r); 40} 41 42 43echo "\nTest 3 - OCI_ASSOC+OCI_NUM\n"; 44$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2"); 45oci_execute($s); 46while (($r = oci_fetch_array($s, OCI_ASSOC+OCI_NUM)) != false) { 47 var_dump($r); 48} 49 50// Clean up 51 52$stmtarray = array( 53 "drop table dupcolnames_tab1", 54 "drop table dupcolnames_tab2", 55); 56 57oci8_test_sql_execute($c, $stmtarray); 58 59?> 60===DONE=== 61<?php exit(0); ?> 62--EXPECT-- 63Test 1 - OCI_ASSOC 64array(3) { 65 ["C1"]=> 66 string(1) "1" 67 ["DUPNAMECOL"]=> 68 string(5) "jones" 69 ["C2"]=> 70 string(1) "2" 71} 72 73Test 2 - OCI_NUM 74array(4) { 75 [0]=> 76 string(1) "1" 77 [1]=> 78 string(5) "chris" 79 [2]=> 80 string(1) "2" 81 [3]=> 82 string(5) "jones" 83} 84 85Test 3 - OCI_ASSOC+OCI_NUM 86array(7) { 87 [0]=> 88 string(1) "1" 89 ["C1"]=> 90 string(1) "1" 91 [1]=> 92 string(5) "chris" 93 ["DUPNAMECOL"]=> 94 string(5) "jones" 95 [2]=> 96 string(1) "2" 97 ["C2"]=> 98 string(1) "2" 99 [3]=> 100 string(5) "jones" 101} 102===DONE=== 103