xref: /PHP-5.4/ext/oci8/tests/conn_attr_1.phpt (revision c7a8bd6a)
1--TEST--
2Set and get of connection attributes with all types of connections.
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
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"))
9    die("skip needs to be run as a DBA user");
10if ($test_drcp) die("skip output might vary with DRCP");
11
12if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
13	die("skip expected output only valid when using Oracle 10g or greater database server");
14} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
15    die("skip test expected to work only with Oracle 10g or greater version of client");
16}
17
18?>
19--FILE--
20<?php
21require(dirname(__FILE__)."/conn_attr.inc");
22
23$attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER');
24
25echo"**Test 1.1 - Default values for the attributes **************\n";
26$c = get_conn(1);
27foreach($attr_array as $attr) {
28        get_attr($c,$attr);
29}
30
31echo"**Test 1.2 - Set and get values for the attributes **************\n";
32
33// With oci_connect, oci_pconnect, oci_new_connect
34
35$conn1 = get_conn(1); //oci_connect()
36foreach($attr_array as $attr) {
37	set_attr($conn1,$attr,1);
38    get_attr($conn1,$attr);
39}
40
41$conn2 = get_conn(2); //oci_pconnect()
42foreach($attr_array as $attr) {
43	set_attr($conn2,$attr,2);
44    get_attr($conn2,$attr);
45}
46
47$conn3 = get_conn(3); //oci_new_connect()
48foreach($attr_array as $attr) {
49	set_attr($conn3,$attr,3);
50    get_attr($conn3,$attr);
51}
52
53// clean up
54oci_close($conn1);
55oci_close($conn2);
56oci_close($conn3);
57clean_up($c);
58
59echo "Done\n";
60
61?>
62--EXPECTF--
63**Test 1.1 - Default values for the attributes **************
64Testing with oci_connect()
65The value of MODULE is %s
66The value of ACTION is
67The value of CLIENT_INFO is
68The value of CLIENT_IDENTIFIER is
69**Test 1.2 - Set and get values for the attributes **************
70Testing with oci_connect()
71Value of MODULE has been set successfully
72The value of MODULE is PHP TEST1
73Value of ACTION has been set successfully
74The value of ACTION is TASK1
75Value of CLIENT_INFO has been set successfully
76The value of CLIENT_INFO is INFO11
77Value of CLIENT_IDENTIFIER has been set successfully
78The value of CLIENT_IDENTIFIER is ID001
79Testing with oci_pconnect()
80Value of MODULE has been set successfully
81The value of MODULE is PHP TEST2
82Value of ACTION has been set successfully
83The value of ACTION is TASK2
84Value of CLIENT_INFO has been set successfully
85The value of CLIENT_INFO is INFO12
86Value of CLIENT_IDENTIFIER has been set successfully
87The value of CLIENT_IDENTIFIER is ID002
88Testing with oci_new_connect()
89Value of MODULE has been set successfully
90The value of MODULE is PHP TEST3
91Value of ACTION has been set successfully
92The value of ACTION is TASK3
93Value of CLIENT_INFO has been set successfully
94The value of CLIENT_INFO is INFO13
95Value of CLIENT_IDENTIFIER has been set successfully
96The value of CLIENT_IDENTIFIER is ID003
97Done
98