bug42134.phpt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. --TEST--
  2. Bug #42134 (Collection error for invalid collection name)
  3. --EXTENSIONS--
  4. oci8
  5. --SKIPIF--
  6. <?php
  7. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  8. require(__DIR__.'/skipif.inc');
  9. ?>
  10. --FILE--
  11. <?php
  12. require(__DIR__.'/details.inc');
  13. // Test collection creation error for normal connection
  14. if (!empty($dbase)) {
  15. $c = oci_connect($user,$password,$dbase);
  16. }
  17. else {
  18. $c = oci_connect($user,$password);
  19. }
  20. $collection = oci_new_collection($c, "ABC");
  21. if (!$collection) {
  22. echo "Normal connection: New Collection error\n";
  23. $m = oci_error($c);
  24. var_dump($m);
  25. }
  26. // Test collection creation error for new connection
  27. if (!empty($dbase)) {
  28. $c = oci_new_connect($user,$password,$dbase);
  29. }
  30. else {
  31. $c = oci_new_connect($user,$password);
  32. }
  33. $collection = oci_new_collection($c, "DEF");
  34. if (!$collection) {
  35. echo "New connection: New Collection error\n";
  36. $m = oci_error($c);
  37. var_dump($m);
  38. }
  39. // Test collection creation error for persistent connection
  40. if (!empty($dbase)) {
  41. $c = oci_pconnect($user,$password,$dbase);
  42. }
  43. else {
  44. $c = oci_pconnect($user,$password);
  45. }
  46. $collection = oci_new_collection($c, "GHI");
  47. if (!$collection) {
  48. echo "Persistent connection: New Collection error\n";
  49. $m = oci_error($c);
  50. var_dump($m);
  51. }
  52. echo "Done\n";
  53. ?>
  54. --EXPECTF--
  55. Warning: oci_new_collection(): OCI-22303: type ""."ABC" not found in %s on line %d
  56. Normal connection: New Collection error
  57. array(4) {
  58. ["code"]=>
  59. int(22303)
  60. ["message"]=>
  61. string(34) "OCI-22303: type ""."ABC" not found"
  62. ["offset"]=>
  63. int(0)
  64. ["sqltext"]=>
  65. string(0) ""
  66. }
  67. Warning: oci_new_collection(): OCI-22303: type ""."DEF" not found in %s on line %d
  68. New connection: New Collection error
  69. array(4) {
  70. ["code"]=>
  71. int(22303)
  72. ["message"]=>
  73. string(34) "OCI-22303: type ""."DEF" not found"
  74. ["offset"]=>
  75. int(0)
  76. ["sqltext"]=>
  77. string(0) ""
  78. }
  79. Warning: oci_new_collection(): OCI-22303: type ""."GHI" not found in %s on line %d
  80. Persistent connection: New Collection error
  81. array(4) {
  82. ["code"]=>
  83. int(22303)
  84. ["message"]=>
  85. string(34) "OCI-22303: type ""."GHI" not found"
  86. ["offset"]=>
  87. int(0)
  88. ["sqltext"]=>
  89. string(0) ""
  90. }
  91. Done