pecl_bug16842.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --TEST--
  2. PECL Bug #16842 (NO_DATA_FOUND exception is a warning)
  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. --INI--
  11. error_reporting = E_WARNING
  12. --FILE--
  13. <?php
  14. require(__DIR__.'/connect.inc');
  15. // Run Test
  16. echo "Test 1\n";
  17. echo "Raises NO_DATA_FOUND\n";
  18. $s = oci_parse($c, 'begin raise NO_DATA_FOUND; end;');
  19. $e = oci_execute($s);
  20. var_dump($e);
  21. var_dump(oci_error($s));
  22. echo "Test 2\n";
  23. echo "Raises ZERO_DIVIDE\n";
  24. $s = oci_parse($c, 'begin raise ZERO_DIVIDE; end;');
  25. $e = oci_execute($s);
  26. var_dump($e);
  27. var_dump(oci_error($s));
  28. oci_close($c);
  29. ?>
  30. --EXPECTF--
  31. Test 1
  32. Raises NO_DATA_FOUND
  33. Warning: oci_execute(): ORA-01403: %s
  34. ORA-06512: at line %d in %specl_bug16842.php on line %d
  35. bool(false)
  36. array(4) {
  37. ["code"]=>
  38. int(1403)
  39. ["message"]=>
  40. string(%d) "ORA-01403: %s
  41. ORA-06512: at line 1"
  42. ["offset"]=>
  43. int(0)
  44. ["sqltext"]=>
  45. string(31) "begin raise NO_DATA_FOUND; end;"
  46. }
  47. Test 2
  48. Raises ZERO_DIVIDE
  49. Warning: oci_execute(): ORA-01476: %s
  50. ORA-06512: at line 1 in %s on line 19
  51. bool(false)
  52. array(4) {
  53. ["code"]=>
  54. int(1476)
  55. ["message"]=>
  56. string(%d) "ORA-01476: %s
  57. ORA-06512: at line 1"
  58. ["offset"]=>
  59. int(0)
  60. ["sqltext"]=>
  61. string(29) "begin raise ZERO_DIVIDE; end;"
  62. }