1--TEST-- 2Test collection Oracle error handling collections and numbers (2) 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 9require __DIR__.'/skipif.inc'; 10?> 11--FILE-- 12<?php 13 14error_reporting(E_ALL ^ E_DEPRECATED); 15 16require __DIR__."/connect.inc"; 17 18$ora_sql = "DROP TYPE ".$type_name; 19$statement = oci_parse($c,$ora_sql); 20@oci_execute($statement); 21 22 23echo "Test 0\n"; 24$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF BLOB"; 25$statement = oci_parse($c,$ora_sql); 26oci_execute($statement); 27 28$coll1 = oci_new_collection($c, $type_name); 29 30var_dump($coll1->append('a long string')); // invalid type for append 31var_dump($coll1->assignElem(1, 'a long string')); // invalid type for assignelem() 32var_dump($coll1->getElem(0)); 33 34require __DIR__."/drop_type.inc"; 35 36echo "Test 1\n"; 37$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER"; 38$statement = oci_parse($c,$ora_sql); 39oci_execute($statement); 40 41$coll1 = oci_new_collection($c, $type_name); 42 43var_dump($coll1->assignElem(1, null)); // invalid location for null 44var_dump($coll1->getElem(0)); 45 46echo "Test 2\n"; 47var_dump($coll1->assignElem(1, 1234)); // invalid location for number 48var_dump($coll1->getElem(0)); 49 50require __DIR__."/drop_type.inc"; 51 52echo "Test 3\n"; 53$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR2(1)"; 54$statement = oci_parse($c,$ora_sql); 55oci_execute($statement); 56 57$coll1 = oci_new_collection($c, $type_name); 58 59var_dump($coll1->assignElem(1, 'abc')); // invalid location for string 60var_dump($coll1->getElem(0)); 61 62require __DIR__."/drop_type.inc"; 63 64echo "Test 4\n"; 65$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE"; 66$statement = oci_parse($c,$ora_sql); 67oci_execute($statement); 68 69$coll1 = oci_new_collection($c, $type_name); 70 71var_dump($coll1->append(1)); // invalid date format 72var_dump($coll1->assignElem(1, '01-JAN-06')); // invalid location for date 73var_dump($coll1->getElem(0)); 74 75require __DIR__."/drop_type.inc"; 76 77echo "Done\n"; 78 79?> 80--EXPECTF-- 81Test 0 82 83Notice: OCICollection::append(): Unknown or unsupported type of element: 113 in %s on line %d 84bool(false) 85 86Notice: OCICollection::assignElem(): Unknown or unsupported type of element: 113 in %s on line %d 87bool(false) 88bool(false) 89Test 1 90 91Warning: OCICollection::assignElem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d 92bool(false) 93bool(false) 94Test 2 95 96Warning: OCICollection::assignElem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d 97bool(false) 98bool(false) 99Test 3 100 101Warning: OCICollection::assignElem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d 102bool(false) 103bool(false) 104Test 4 105 106Warning: OCICollection::append(): OCI-01840: input value not long enough for date format in %s on line %d 107bool(false) 108 109Warning: OCICollection::assignElem(): OCI-22165: given index [1] must be in the range of %s in %s on line %d 110bool(false) 111bool(false) 112Done 113