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