xref: /PHP-5.3/ext/oci8/tests/conn_attr_5.phpt (revision c7a8bd6a)
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
11if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
12	die("skip expected output only valid when using Oracle 10g or greater database server");
13} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
14    die("skip test expected to work only with Oracle 10g or greater version of client");
15}
16?>
17--FILE--
18<?php
19require(dirname(__FILE__)."/conn_attr.inc");
20
21echo"**Test - Set and get values for the attributes with scope end ************\n";
22
23// Set the attributes in one scope and verify the values from another scope.
24set_scope();
25
26echo "Get the Values from a different scope \n";
27get_scope();
28
29function set_scope() {
30    $conn1 = get_conn(1);
31    set_attr($conn1,'CLIENT_INFO',50);
32    set_attr($conn1,'CLIENT_IDENTIFIER',50);
33    $conn2 = get_conn(3);
34    set_attr($conn2,'ACTION',50);
35    $conn3 = get_conn(2);
36    set_attr($conn3,'MODULE',50);
37
38}
39
40function get_scope() {
41    $conn1 = get_conn(1);
42    get_attr($conn1,'CLIENT_INFO');
43    get_attr($conn1,'CLIENT_IDENTIFIER');
44    $conn2 = get_conn(3);
45    get_attr($conn2,'ACTION');
46    $conn3 = get_conn(2);
47    get_attr($conn3,'MODULE');
48}
49clean_up($c);
50echo "Done";
51?>
52--EXPECTF--
53**Test - Set and get values for the attributes with scope end ************
54Testing with oci_connect()
55Value of CLIENT_INFO has been set successfully
56Value of CLIENT_IDENTIFIER has been set successfully
57Testing with oci_new_connect()
58Value of ACTION has been set successfully
59Testing with oci_pconnect()
60Value of MODULE has been set successfully
61Get the Values from a different scope
62Testing with oci_connect()
63The value of CLIENT_INFO is
64The value of CLIENT_IDENTIFIER is
65Testing with oci_new_connect()
66The value of ACTION is
67Testing with oci_pconnect()
68The value of MODULE is PHP TEST50
69Done
70