Annotation of embedaddon/php/ext/oci8/tests/driver_name.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Verify that the Driver Name attribute is set
3: --SKIPIF--
4: <?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
5:
6: require(dirname(__FILE__)."/connect.inc");
7: if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
8: if ($test_drcp) die("skip as Output might vary with DRCP");
9:
10: if (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
19: require(dirname(__FILE__)."/connect.inc");
20:
21: echo"**Test 1.1 - Default values for the attribute **************\n";
22: get_attr($c);
23: oci_close($c);
24:
25: echo"\n***Test 1.2 - Get the values from different connections **************\n";
26: // with oci_pconnect()
27: echo "Testing with oci_pconnect()\n";
28: $pc1=oci_pconnect($user,$password,$dbase);
29: get_attr($pc1);
30: oci_close($pc1);
31:
32: echo "Testing with oci_new_connect()\n";
33: $nc1=oci_new_connect($user,$password,$dbase);
34: get_attr($nc1);
35: oci_close($nc1);
36: echo "Done\n";
37:
38: function 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 **************
54: The value of DRIVER_NAME is PHP OCI8
55:
56: ***Test 1.2 - Get the values from different connections **************
57: Testing with oci_pconnect()
58: The value of DRIVER_NAME is PHP OCI8
59: Testing with oci_new_connect()
60: The value of DRIVER_NAME is PHP OCI8
61: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>