1--TEST-- 2Verify that the Driver Name attribute is set 3--SKIPIF-- 4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); 5 6require(__DIR__."/connect.inc"); 7if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); 8if ($test_drcp) die("skip as Output might vary with DRCP"); 9 10preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11if (!(isset($matches[0]) && ($matches[1] == 11 && $matches[2] >= 2))) { 12 die("skip expected output only valid when using Oracle 11.2 database or its later patchsets"); 13} 14preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); 15if (!(isset($matches[0]) && ($matches[1] == 11 && $matches[2] >= 2) || ($matches[1] > 11))) { 16 die("skip test expected to work only with Oracle 11.2 or greater version of client"); 17} 18 19?> 20--FILE-- 21<?php 22require(__DIR__."/connect.inc"); 23 24echo"**Test 1.1 - Default values for the attribute **************\n"; 25get_attr($c); 26oci_close($c); 27 28echo"\n***Test 1.2 - Get the values from different connections **************\n"; 29// with oci_pconnect() 30echo "Testing with oci_pconnect()\n"; 31$pc1=oci_pconnect($user,$password,$dbase); 32get_attr($pc1); 33oci_close($pc1); 34 35echo "Testing with oci_new_connect()\n"; 36$nc1=oci_new_connect($user,$password,$dbase); 37get_attr($nc1); 38oci_close($nc1); 39echo "Done\n"; 40 41function get_attr($conn) 42{ 43 $sel_stmt = "select client_driver 44 from v\$session_connect_info sci, v\$session s 45 where sci.client_driver is not null 46 and sci.sid = s.sid 47 and s.audsid = userenv('SESSIONID')"; 48 $s2 = oci_parse($conn,$sel_stmt); 49 oci_execute($s2,OCI_DEFAULT); 50 oci_fetch($s2); 51 echo "The value of DRIVER_NAME is ".trim(oci_result($s2,1))."\n"; 52} 53 54?> 55--EXPECT-- 56**Test 1.1 - Default values for the attribute ************** 57The value of DRIVER_NAME is PHP OCI8 58 59***Test 1.2 - Get the values from different connections ************** 60Testing with oci_pconnect() 61The value of DRIVER_NAME is PHP OCI8 62Testing with oci_new_connect() 63The value of DRIVER_NAME is PHP OCI8 64Done 65