Annotation of embedaddon/php/ext/oci8/tests/conn_attr_4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Set and get of connection attributes with errors.
3: --SKIPIF--
4: <?php
5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
6: require(dirname(__FILE__).'/skipif.inc');
7: if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
8:
9: if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
10: if ($test_drcp) die("skip output might vary with DRCP");
11:
12: if (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) {
13: // Bug fixed in 11.2 prevents client_info being rest
14: die("skip expected output only valid when using Oracle 11gR2 or greater database server");
15: } else if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
16: die("skip test expected to work only with Oracle 10g or greater version of client");
17: }
18: ?>
19: --FILE--
20: <?php
21:
22:
23: require(dirname(__FILE__)."/conn_attr.inc");
24:
25: $user='testuser';
26: $password='testuser';
27: $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER');
28:
29: echo"**Test Negative cases************\n";
30:
31: echo "\nInvalid Connection resource\n";
32: $nc1=NULL;
33: // Invalid connection handle.
34: var_dump(oci_set_action($nc1,$nc1));
35:
36: // Variable instead of a connection resource.
37: echo "\nInvalid Connection resource 2\n";
38: $str1= 'not a conn';
39: var_dump(oci_set_client_info($str1,$str1));
40:
41: // Setting an Invalid value.
42: echo "\nInvalid Value \n";
43: $c1=oci_connect($user,$password,$dbase);
44: var_dump(oci_set_action($c1,$c1));
45:
46: // Setting values multiple times.
47: echo "\nSet Values multiple times \n";
48: var_dump(oci_set_action($c1,'ACTION1'));
49: var_dump(oci_set_action($c1,'ACTION1'));
50: var_dump(oci_set_action($c1,'ACTION2'));
51: var_dump(oci_set_action($c1,'ACTION1'));
52: get_attr($c1,'ACTION');
53:
54: // Testing with different types of values
55: // NB. This may diff in 11.1.0.6 due to a bug causing CLIENT_INFO of NULL to be ignored.
56: echo "\nSetting to different values \n";
57: $values_array = array(1000,NULL,'this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!');
58:
59: foreach($values_array as $val ) {
60: oci_set_module_name($c1,$val);
61: oci_set_client_identifier($c1,$val);
62: oci_set_client_info($c1,$val);
63: $r = oci_set_action($c1,$val);
64: if ($r) {
65: echo "Values set succesfully to $val\n";
66: foreach($attr_array as $attr) {
67: get_attr($c1,$attr);
68: }
69: }
70: }
71:
72: clean_up($c);
73: echo "Done\n";
74: ?>
75: --EXPECTF--
76: **Test Negative cases************
77:
78: Invalid Connection resource
79:
80: Warning: oci_set_action() expects parameter 1 to be resource, null given in %s on line %d
81: NULL
82:
83: Invalid Connection resource 2
84:
85: Warning: oci_set_client_info() expects parameter 1 to be resource, %s given in %s on line %d
86: NULL
87:
88: Invalid Value
89:
90: Warning: oci_set_action() expects parameter 2 to be %s, resource given in %s on line %d
91: NULL
92:
93: Set Values multiple times
94: bool(true)
95: bool(true)
96: bool(true)
97: bool(true)
98: The value of ACTION is ACTION1
99:
100: Setting to different values
101: Values set succesfully to 1000
102: The value of MODULE is 1000
103: The value of ACTION is 1000
104: The value of CLIENT_INFO is 1000
105: The value of CLIENT_IDENTIFIER is 1000
106: Values set succesfully to
107: The value of MODULE is
108: The value of ACTION is
109: The value of CLIENT_INFO is
110: The value of CLIENT_IDENTIFIER is
111:
112: Warning: oci_set_module_name(): ORA-24960: %s OCI_ATTR_MODULE %s on line %d
113:
114: Warning: oci_set_client_identifier(): ORA-24960: %s OCI_ATTR_CLIENT_IDENTIFIER %s on line %d
115:
116: Warning: oci_set_client_info(): ORA-24960: %s OCI_ATTR_CLIENT_INFO %s on line %d
117:
118: Warning: oci_set_action(): ORA-24960: %s OCI_ATTR_ACTION %s on line %d
119: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>