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