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