xref: /PHP-7.0/ext/oci8/tests/conn_attr_3.phpt (revision 0d909f5b)
1--TEST--
2Set and get of connection attributes with oci_close().
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_3';  // 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 oci_close() ************\n";
25// With oci_connect ,oci_pconnect ,oci_new_connect
26
27var_dump($conn1 = get_conn(1)); //oci_connect()
28set_attr($conn1,'ACTION',1);
29get_attr($conn1,'ACTION');
30oci_close($conn1);
31
32// Open another connect and verify the value.
33var_dump($conn1 = get_conn(1)); //oci_connect()
34get_attr($conn1,'ACTION');
35oci_close($conn1);
36
37var_dump($pconn1 = get_conn(2)); //oci_pconnect()
38set_attr($pconn1,'MODULE',2);
39get_attr($pconn1,'MODULE');
40oci_close($pconn1);
41
42// Open another connect and verify the value.
43var_dump($pconn1 = get_conn(2)); //oci_pconnect()
44get_attr($pconn1,'MODULE');
45oci_close($pconn1);
46
47var_dump($nconn1 = get_conn(3)); //oci_new_connect()
48set_attr($nconn1,'CLIENT_INFO',3);
49set_attr($nconn1,'CLIENT_IDENTIFIER',3);
50get_attr($nconn1,'CLIENT_INFO');
51get_attr($nconn1,'CLIENT_IDENTIFIER');
52oci_close($nconn1);
53
54// Open another connect and verify the value.
55var_dump($nconn1 = get_conn(3)); //oci_new_connect()
56get_attr($nconn1,'CLIENT_INFO');
57get_attr($nconn1,'CLIENT_IDENTIFIER');
58oci_close($nconn1);
59
60clean_up($c);
61echo "Done\n";
62
63?>
64--EXPECTF--
65**Test Set and get values for  the attributes with oci_close() ************
66Testing with oci_connect()
67resource(%d) of type (oci8 connection)
68Value of ACTION has been set successfully
69The value of ACTION is TASK1
70Testing with oci_connect()
71resource(%d) of type (oci8 connection)
72The value of ACTION is
73Testing with oci_pconnect()
74resource(%d) of type (oci8 persistent connection)
75Value of MODULE has been set successfully
76The value of MODULE is PHP TEST2
77Testing with oci_pconnect()
78resource(%d) of type (oci8 persistent connection)
79The value of MODULE is PHP TEST2
80Testing with oci_new_connect()
81resource(%d) of type (oci8 connection)
82Value of CLIENT_INFO has been set successfully
83Value of CLIENT_IDENTIFIER has been set successfully
84The value of CLIENT_INFO is INFO13
85The value of CLIENT_IDENTIFIER is ID003
86Testing with oci_new_connect()
87resource(%d) of type (oci8 connection)
88The value of CLIENT_INFO is
89The value of CLIENT_IDENTIFIER is
90Done
91