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