fetch_all4.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --TEST--
  2. Test oci_fetch_* array overwriting when query returns no rows
  3. --SKIPIF--
  4. <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
  5. --FILE--
  6. <?php
  7. require(dirname(__FILE__).'/connect.inc');
  8. // Initialization
  9. $stmtarray = array(
  10. "drop table fetch_all4_tab",
  11. "create table fetch_all4_tab (mycol1 number, mycol2 varchar2(20))",
  12. "insert into fetch_all4_tab values (1, 'abc')"
  13. );
  14. oci8_test_sql_execute($c, $stmtarray);
  15. // Run Test
  16. echo "Test 1\n";
  17. $s = oci_parse($c, "select * from fetch_all4_tab where 1 = 0");
  18. oci_execute($s);
  19. $res = array(1,2,3); // this array is replaced as a result of the query
  20. $r = oci_fetch_all($s, $res);
  21. var_dump($r);
  22. var_dump($res);
  23. echo "Test 2\n";
  24. $s = oci_parse($c, "select * from fetch_all4_tab where 1 = 0");
  25. oci_execute($s);
  26. $row = array(1,2,3); // this array is replaced as a result of the query
  27. $row = oci_fetch_array($s);
  28. var_dump($row);
  29. // Clean up
  30. $stmtarray = array(
  31. "drop table fetch_all4_tab"
  32. );
  33. oci8_test_sql_execute($c, $stmtarray);
  34. ?>
  35. ===DONE===
  36. <?php exit(0); ?>
  37. --EXPECTF--
  38. Test 1
  39. int(0)
  40. array(2) {
  41. ["MYCOL1"]=>
  42. array(0) {
  43. }
  44. ["MYCOL2"]=>
  45. array(0) {
  46. }
  47. }
  48. Test 2
  49. bool(false)
  50. ===DONE===