1--TEST-- 2PDO_OCI: Attribute: Column Case 3--EXTENSIONS-- 4pdo 5pdo_oci 6--SKIPIF-- 7<?php 8require(__DIR__.'/../../pdo/tests/pdo_test.inc'); 9PDOTest::skip(); 10?> 11--FILE-- 12<?php 13 14require(__DIR__ . '/../../pdo/tests/pdo_test.inc'); 15 16function do_query1($dbh) 17{ 18 var_dump($dbh->getAttribute(PDO::ATTR_CASE)); 19 $s = $dbh->prepare("select dummy from dual"); 20 $s->execute(); 21 while ($r = $s->fetch(PDO::FETCH_ASSOC)) { 22 var_dump($r); 23 } 24} 25 26function do_query2($dbh, $mode) 27{ 28 echo "Mode desired is $mode\n"; 29 $s = $dbh->prepare("select dummy from dual", array(PDO::ATTR_CASE, $mode)); 30 $s->execute(); 31 while ($r = $s->fetch(PDO::FETCH_ASSOC)) { 32 var_dump($r); 33 } 34} 35 36$dbh = PDOTest::factory(); 37$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 38 39echo "Test 1 - Force column names to lower case\n"; 40$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); 41do_query1($dbh); 42 43echo "Test 2 - Leave column names as returned by the database driver\n"; 44$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); 45do_query1($dbh); 46 47echo "Test 3 - Force column names to upper case\n"; 48$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER); 49do_query1($dbh); 50 51echo "Test 4 - Setting on statement has no effect. Attempt lower case but get upper\n"; 52$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); // reset 53do_query2($dbh, PDO::CASE_LOWER); 54 55echo "Done\n"; 56 57?> 58--EXPECT-- 59Test 1 - Force column names to lower case 60int(2) 61array(1) { 62 ["dummy"]=> 63 string(1) "X" 64} 65Test 2 - Leave column names as returned by the database driver 66int(0) 67array(1) { 68 ["DUMMY"]=> 69 string(1) "X" 70} 71Test 3 - Force column names to upper case 72int(1) 73array(1) { 74 ["DUMMY"]=> 75 string(1) "X" 76} 77Test 4 - Setting on statement has no effect. Attempt lower case but get upper 78Mode desired is 2 79array(1) { 80 ["DUMMY"]=> 81 string(1) "X" 82} 83Done 84