xref: /PHP-7.3/ext/oci8/tests/conn_attr_5.phpt (revision bdd67d81)
1--TEST--
2Set and get connection attributes with scope end.
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6require(dirname(__FILE__).'/skipif.inc');
7
8if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
9if ($test_drcp) die("skip output might vary with DRCP");
10
11preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
12if (!(isset($matches[0]) && $matches[1] >= 10)) {
13	die("skip expected output only valid when using Oracle 10g or greater database server");
14}
15?>
16--FILE--
17<?php
18
19$testuser     = 'testuser_attr_5';  // Used in conn_attr.inc
20$testpassword = 'testuser';
21
22require(dirname(__FILE__)."/conn_attr.inc");
23
24echo"**Test - Set and get values for the attributes with scope end ************\n";
25
26// Set the attributes in one scope and verify the values from another scope.
27set_scope();
28
29echo "Get the Values from a different scope \n";
30get_scope();
31
32function set_scope() {
33    $conn1 = get_conn(1);
34    set_attr($conn1,'CLIENT_INFO',50);
35    set_attr($conn1,'CLIENT_IDENTIFIER',50);
36    $conn2 = get_conn(3);
37    set_attr($conn2,'ACTION',50);
38    $conn3 = get_conn(2);
39    set_attr($conn3,'MODULE',50);
40}
41
42function get_scope() {
43    $conn1 = get_conn(1);
44    get_attr($conn1,'CLIENT_INFO');
45    get_attr($conn1,'CLIENT_IDENTIFIER');
46    $conn2 = get_conn(3);
47    get_attr($conn2,'ACTION');
48    $conn3 = get_conn(2);
49    get_attr($conn3,'MODULE');
50}
51clean_up($c);
52echo "Done";
53?>
54--EXPECT--
55**Test - Set and get values for the attributes with scope end ************
56Testing with oci_connect()
57Value of CLIENT_INFO has been set successfully
58Value of CLIENT_IDENTIFIER has been set successfully
59Testing with oci_new_connect()
60Value of ACTION has been set successfully
61Testing with oci_pconnect()
62Value of MODULE has been set successfully
63Get the Values from a different scope
64Testing with oci_connect()
65The value of CLIENT_INFO is
66The value of CLIENT_IDENTIFIER is
67Testing with oci_new_connect()
68The value of ACTION is
69Testing with oci_pconnect()
70The value of MODULE is PHP TEST50
71Done
72