1--TEST-- 2DRCP: Test setting connection class inline 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8require __DIR__.'/connect.inc'; 9if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode"); 10// Looked for :pooled in EZ connect string 11if (strpos($dbase, "/") !== false && stripos($dbase, ":pooled") === false) 12 die('skip DRCP test requires a DRCP pooled server connection'); 13if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); 14 15preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); 16// This test in Oracle 12c needs a non-CDB or the root container 17if (isset($matches_sv[0]) && $matches_sv[1] >= 12) { 18 $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual"); 19 $r = @oci_execute($s); 20 if (!$r) 21 die('skip could not identify container type'); 22 $r = oci_fetch_array($s); 23 if ($r['DBTYPE'] !== 'CDB$ROOT') 24 die('skip cannot run test using a PDB'); 25} 26?> 27--FILE-- 28<?php 29 30require __DIR__."/details.inc"; 31 32// Initialization 33 34$t = time(); 35$cc1 = 'cc1_'.$t; 36$cc2 = 'cc2_'.$t; 37 38// Run Test 39 40echo "Test 1\n"; 41 42ini_set('oci8.connection_class', $cc1); 43$c = oci_pconnect($user, $password, $dbase); 44$s = oci_parse($c, "select * from dual"); 45oci_execute($s); 46oci_fetch_all($s, $r); 47var_dump($r); 48 49echo "Test 2\n"; 50 51ini_set('oci8.connection_class', $cc2); 52$c = oci_pconnect($user, $password, $dbase); 53$s = oci_parse($c, "select * from dual"); 54oci_execute($s); 55oci_fetch_all($s, $r); 56var_dump($r); 57 58echo "Test 3\n"; 59 60$s = oci_parse($c, "select cclass_name from v\$cpool_cc_stats where cclass_name like '%.cc__$t' order by cclass_name"); 61oci_execute($s); 62oci_fetch_all($s, $r); 63var_dump($r); 64 65// Cleanup 66 67echo "Done\n"; 68 69?> 70--EXPECTF-- 71Test 1 72array(1) { 73 ["DUMMY"]=> 74 array(1) { 75 [0]=> 76 string(1) "X" 77 } 78} 79Test 2 80array(1) { 81 ["DUMMY"]=> 82 array(1) { 83 [0]=> 84 string(1) "X" 85 } 86} 87Test 3 88array(1) { 89 ["CCLASS_NAME"]=> 90 array(2) { 91 [0]=> 92 string(21) "%s.cc1_%d" 93 [1]=> 94 string(21) "%s.cc2_%d" 95 } 96} 97Done 98