xref: /PHP-5.3/ext/oci8/tests/driver_name.phpt (revision c7a8bd6a)
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(dirname(__FILE__)."/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
10if (preg_match('/Release (11\.2|12)/', oci_server_version($c), $matches) !== 1) {
11	die("skip expected output only valid when using Oracle 11gR2 or greater databases");
12} else if (preg_match('/^(11\.2|12\.)/', oci_client_version()) != 1) {
13    die("skip test expected to work only with Oracle 11g or greater version of client");
14}
15
16?>
17--FILE--
18<?php
19require(dirname(__FILE__)."/connect.inc");
20
21echo"**Test 1.1 - Default values for the attribute **************\n";
22get_attr($c);
23oci_close($c);
24
25echo"\n***Test 1.2 - Get the values from different connections **************\n";
26// with oci_pconnect()
27echo "Testing with oci_pconnect()\n";
28$pc1=oci_pconnect($user,$password,$dbase);
29get_attr($pc1);
30oci_close($pc1);
31
32echo "Testing with oci_new_connect()\n";
33$nc1=oci_new_connect($user,$password,$dbase);
34get_attr($nc1);
35oci_close($nc1);
36echo "Done\n";
37
38function get_attr($conn)
39{
40	$sel_stmt = "select client_driver
41        from v\$session_connect_info sci, v\$session s
42        where sci.client_driver is not null
43          and sci.sid = s.sid
44          and s.audsid = userenv('SESSIONID')";
45    $s2 = oci_parse($conn,$sel_stmt);
46    oci_execute($s2,OCI_DEFAULT);
47    oci_fetch($s2);
48    echo "The value of DRIVER_NAME is ".oci_result($s2,1)."\n";
49}
50
51?>
52--EXPECT--
53**Test 1.1 - Default values for the attribute **************
54The value of DRIVER_NAME is PHP OCI8
55
56***Test 1.2 - Get the values from different connections **************
57Testing with oci_pconnect()
58The value of DRIVER_NAME is PHP OCI8
59Testing with oci_new_connect()
60The value of DRIVER_NAME is PHP OCI8
61Done
62