xref: /PHP-7.0/ext/oci8/tests/conn_attr_5.phpt (revision 0d909f5b)
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}
42
43function get_scope() {
44    $conn1 = get_conn(1);
45    get_attr($conn1,'CLIENT_INFO');
46    get_attr($conn1,'CLIENT_IDENTIFIER');
47    $conn2 = get_conn(3);
48    get_attr($conn2,'ACTION');
49    $conn3 = get_conn(2);
50    get_attr($conn3,'MODULE');
51}
52clean_up($c);
53echo "Done";
54?>
55--EXPECTF--
56**Test - Set and get values for the attributes with scope end ************
57Testing with oci_connect()
58Value of CLIENT_INFO has been set successfully
59Value of CLIENT_IDENTIFIER has been set successfully
60Testing with oci_new_connect()
61Value of ACTION has been set successfully
62Testing with oci_pconnect()
63Value of MODULE has been set successfully
64Get the Values from a different scope
65Testing with oci_connect()
66The value of CLIENT_INFO is
67The value of CLIENT_IDENTIFIER is
68Testing with oci_new_connect()
69The value of ACTION is
70Testing with oci_pconnect()
71The value of MODULE is PHP TEST50
72Done
73