coll_016_func.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. collections and negative/too big element indexes
  3. --SKIPIF--
  4. <?php
  5. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  6. require(dirname(__FILE__).'/skipif.inc');
  7. ?>
  8. --FILE--
  9. <?php
  10. require dirname(__FILE__)."/connect.inc";
  11. $ora_sql = "DROP TYPE
  12. ".$type_name."
  13. ";
  14. $statement = OCIParse($c,$ora_sql);
  15. @OCIExecute($statement);
  16. $ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
  17. $statement = OCIParse($c,$ora_sql);
  18. OCIExecute($statement);
  19. $coll1 = ocinewcollection($c, $type_name);
  20. var_dump(oci_collection_append($coll1, 1));
  21. var_dump(oci_collection_element_assign($coll1,-1,2345));
  22. var_dump(oci_collection_element_assign($coll1,5000,2345));
  23. var_dump(oci_collection_element_get($coll1, -1));
  24. var_dump(oci_collection_element_get($coll1, -100));
  25. var_dump(oci_collection_element_get($coll1, 500));
  26. echo "Done\n";
  27. require dirname(__FILE__)."/drop_type.inc";
  28. ?>
  29. --EXPECTF--
  30. bool(true)
  31. Warning: oci_collection_element_assign(): OCI-22165: given index [%d] must be in the range of%s0%sto [0] in %s on line %d
  32. bool(false)
  33. Warning: oci_collection_element_assign(): OCI-22165: given index [5000] must be in the range of%s0%sto [0] in %s on line %d
  34. bool(false)
  35. bool(false)
  36. bool(false)
  37. bool(false)
  38. Done