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