Annotation of embedaddon/php/ext/oci8/tests/conn_attr_2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Set and get of connection attributes across persistent connections and sysdba connection.
3: --SKIPIF--
4: <?php
5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
6: require(dirname(__FILE__).'/skipif.inc');
7:
8: if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
9: if ($test_drcp) die("skip output might vary with DRCP");
10:
11: if (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: ?>
18: --INI--
19: oci8.privileged_connect = On
20: --FILE--
21:
22: <?php
23: require(dirname(__FILE__)."/conn_attr.inc");
24: $user='testuser';
25: $password='testuser';
26: $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER');
27:
28: echo"**Set values using pconnect-1**\n";
29:
30: var_dump($pc1 = oci_pconnect($user,$password,$dbase));
31: foreach($attr_array as $attr) {
32: set_attr($pc1,$attr,100);
33: }
34:
35: // using pc1 again
36: echo"\n**Get values using pconnect-2**\n";
37: var_dump($pc3 = oci_pconnect($user,$password,$dbase));
38: foreach($attr_array as $attr) {
39: get_attr($pc3,$attr);
40: }
41:
42: // Get with different pconnect
43: echo"\n**Get values using pconnect-3**\n";
44: var_dump($pc2 = oci_pconnect($user,$password,$dbase,'UTF8'));
45: foreach($attr_array as $attr) {
46: get_attr($pc2,$attr);
47: }
48:
49: oci_close($pc1);
50: oci_close($pc2);
51: oci_close($pc3);
52:
53: // Re-open a persistent connection and check for the attr values.
54: echo "\n**Re-open a pconnect()**\n";
55: var_dump($pc4 = oci_pconnect($user,$password,$dbase));
56: foreach($attr_array as $attr) {
57: get_attr($pc4,$attr);
58: }
59: oci_close($pc4);
60:
61: // Test with SYSDBA connection.
62: var_dump($sys_c1 = oci_pconnect($user,$password,$dbase,false,OCI_SYSDBA));
63: if ($sys_c1) {
64: set_attr($sys_c1,'ACTION',10);
65: get_sys_attr($sys_c1,'ACTION');
66: get_attr($pc2,'ACTION');
67: oci_close($sys_c1);
68: }
69:
70: clean_up($c);
71:
72: echo "Done\n";
73: ?>
74: --EXPECTF--
75: **Set values using pconnect-1**
76: resource(%d) of type (oci8 persistent connection)
77: Value of MODULE has been set successfully
78: Value of ACTION has been set successfully
79: Value of CLIENT_INFO has been set successfully
80: Value of CLIENT_IDENTIFIER has been set successfully
81:
82: **Get values using pconnect-2**
83: resource(%d) of type (oci8 persistent connection)
84: The value of MODULE is PHP TEST100
85: The value of ACTION is TASK100
86: The value of CLIENT_INFO is INFO1100
87: The value of CLIENT_IDENTIFIER is ID00100
88:
89: **Get values using pconnect-3**
90: resource(%d) of type (oci8 persistent connection)
91: The value of MODULE is %s
92: The value of ACTION is
93: The value of CLIENT_INFO is
94: The value of CLIENT_IDENTIFIER is
95:
96: **Re-open a pconnect()**
97: resource(%d) of type (oci8 persistent connection)
98: The value of MODULE is PHP TEST100
99: The value of ACTION is TASK100
100: The value of CLIENT_INFO is INFO1100
101: The value of CLIENT_IDENTIFIER is ID00100
102:
103: Warning: oci_pconnect(): ORA-01031: %s on line %d
104: bool(false)
105: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>