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