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