1--TEST-- 2Bind with SQLT_INT 3--SKIPIF-- 4<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> 5--FILE-- 6<?php 7 8require(__DIR__.'/connect.inc'); 9 10// Initialization 11 12$stmtarray = array( 13 "drop table bind_sqltint_tab", 14 15 "create table bind_sqltint_tab ( 16 id number, 17 varchar2_t10 varchar2(10), 18 number_t number, 19 number_t92 number(9,2))", 20 21); 22 23oci8_test_sql_execute($c, $stmtarray); 24 25function check_col($c, $colname, $id) 26{ 27 $s = oci_parse($c, "select $colname from bind_sqltint_tab where id = :id"); 28 oci_bind_by_name($s, ":id", $id); 29 oci_execute($s); 30 oci_fetch_all($s, $r); 31 var_dump($r); 32} 33 34// Run Test 35 36echo "\nTEST141 wrong bind type SQLT_INT\n"; 37 38$c2 = "Hood141"; 39$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, varchar2_t10) VALUES (141, :c2)"); 40oci_bind_by_name($s, ":c2", $c2, -1, SQLT_INT); 41oci_execute($s); 42 43check_col($c, 'varchar2_t10', 141); 44 45echo "\nTEST142 insert numbers SQLT_INT\n"; 46 47$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (142, :n1)"); 48$n1 = 42; 49oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 50oci_execute($s); 51 52check_col($c, 'number_t', 142); 53 54echo "\nTEST143 insert numbers, SQLT_INT\n"; 55 56$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (143, :n1)"); 57$n1 = 42.69; 58oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 59oci_execute($s); 60 61check_col($c, 'number_t', 143); 62 63echo "\nTEST144 insert numbers with SQLT_INT\n"; 64 65$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (144, :n1)"); 66$n1 = 0; 67oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 68oci_execute($s); 69 70check_col($c, 'number_t', 144); 71 72echo "\nTEST145 insert numbers with SQLT_INT\n"; 73 74$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (145, :n1)"); 75$n1 = -23; 76oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 77oci_execute($s); 78 79check_col($c, 'number_t', 145); 80 81echo "\nTEST146 insert numbers\n"; 82 83$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (146, :n1)"); 84$n1 = "-23"; 85oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 86oci_execute($s); 87 88check_col($c, 'number_t', 146); 89 90echo "\nTEST147 insert numbers with SQLT_INT\n"; 91 92$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (147, :n1)"); 93$n1 = "23"; 94oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 95oci_execute($s); 96 97check_col($c, 'number_t', 147); 98 99echo "\nTEST148 insert numbers with SQLT_INT\n"; 100 101$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (148, :n1)"); 102$n1 = 123.56; 103oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 104oci_execute($s); 105 106check_col($c, 'number_t92', 148); 107 108echo "\nTEST149 insert numbers with SQLT_INT\n"; 109 110$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (149, :n1)"); 111$n1 = "123.56"; 112oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 113oci_execute($s); 114 115check_col($c, 'number_t92', 149); 116 117echo "\nTEST150 insert numbers with SQLT_INT\n"; 118 119$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (150, :n1)"); 120$n1 = ""; 121oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT); 122oci_execute($s); 123 124check_col($c, 'number_t92', 150); 125 126echo "\nTEST151 - 159 Initialization tests\n"; 127 128$s = oci_parse($c, "begin :p2 := :p1; end;"); 129unset($p1); 130unset($p2); 131oci_bind_by_name($s, ":p1", $p1, 10); 132oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 133oci_execute($s); 134var_dump($p2); 135 136echo "\nTEST152\n"; 137 138unset($p1); 139$p2 = null; 140oci_bind_by_name($s, ":p1", $p1, 10); 141oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 142oci_execute($s); 143var_dump($p2); 144 145echo "\nTEST153\n"; 146 147unset($p1); 148$p2 = 1111; 149oci_bind_by_name($s, ":p1", $p1, 10); 150oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 151oci_execute($s); 152var_dump($p2); 153 154echo "\nTEST154\n"; 155 156$p1 = null; 157unset($p2); 158oci_bind_by_name($s, ":p1", $p1, 10); 159oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 160oci_execute($s); 161var_dump($p2); 162 163echo "\nTEST155\n"; 164 165$p1 = null; 166$p2 = null; 167oci_bind_by_name($s, ":p1", $p1, 10); 168oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 169oci_execute($s); 170var_dump($p2); 171 172echo "\nTEST156\n"; 173 174$p1 = null; 175$p2 = 2222; 176oci_bind_by_name($s, ":p1", $p1, 10); 177oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 178oci_execute($s); 179var_dump($p2); 180 181echo "\nTEST157\n"; 182 183$p1 = 3333; 184unset($p2); 185oci_bind_by_name($s, ":p1", $p1, 10); 186oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 187oci_execute($s); 188var_dump($p2); 189 190echo "\nTEST158\n"; 191 192$p1 = 4444; 193$p2 = null; 194oci_bind_by_name($s, ":p1", $p1, 10); 195oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 196oci_execute($s); 197var_dump($p2); 198 199echo "\nTEST159\n"; 200 201$p1 = 5555; 202$p2 = 6666; 203oci_bind_by_name($s, ":p1", $p1, 10); 204oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT); 205oci_execute($s); 206var_dump($p2); 207 208// Clean up 209 210$stmtarray = array( 211 "drop table bind_sqltint_tab" 212); 213 214oci8_test_sql_execute($c, $stmtarray); 215 216?> 217===DONE=== 218<?php exit(0); ?> 219--EXPECT-- 220TEST141 wrong bind type SQLT_INT 221array(1) { 222 ["VARCHAR2_T10"]=> 223 array(1) { 224 [0]=> 225 string(1) "0" 226 } 227} 228 229TEST142 insert numbers SQLT_INT 230array(1) { 231 ["NUMBER_T"]=> 232 array(1) { 233 [0]=> 234 string(2) "42" 235 } 236} 237 238TEST143 insert numbers, SQLT_INT 239array(1) { 240 ["NUMBER_T"]=> 241 array(1) { 242 [0]=> 243 string(2) "42" 244 } 245} 246 247TEST144 insert numbers with SQLT_INT 248array(1) { 249 ["NUMBER_T"]=> 250 array(1) { 251 [0]=> 252 string(1) "0" 253 } 254} 255 256TEST145 insert numbers with SQLT_INT 257array(1) { 258 ["NUMBER_T"]=> 259 array(1) { 260 [0]=> 261 string(3) "-23" 262 } 263} 264 265TEST146 insert numbers 266array(1) { 267 ["NUMBER_T"]=> 268 array(1) { 269 [0]=> 270 string(3) "-23" 271 } 272} 273 274TEST147 insert numbers with SQLT_INT 275array(1) { 276 ["NUMBER_T"]=> 277 array(1) { 278 [0]=> 279 string(2) "23" 280 } 281} 282 283TEST148 insert numbers with SQLT_INT 284array(1) { 285 ["NUMBER_T92"]=> 286 array(1) { 287 [0]=> 288 string(3) "123" 289 } 290} 291 292TEST149 insert numbers with SQLT_INT 293array(1) { 294 ["NUMBER_T92"]=> 295 array(1) { 296 [0]=> 297 string(3) "123" 298 } 299} 300 301TEST150 insert numbers with SQLT_INT 302array(1) { 303 ["NUMBER_T92"]=> 304 array(1) { 305 [0]=> 306 string(1) "0" 307 } 308} 309 310TEST151 - 159 Initialization tests 311NULL 312 313TEST152 314NULL 315 316TEST153 317NULL 318 319TEST154 320NULL 321 322TEST155 323NULL 324 325TEST156 326NULL 327 328TEST157 329int(3333) 330 331TEST158 332int(4444) 333 334TEST159 335int(5555) 336===DONE=== 337