fetch_all4.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --TEST--
  2. Test oci_fetch_* array overwriting when query returns no rows
  3. --EXTENSIONS--
  4. oci8
  5. --FILE--
  6. <?php
  7. require(__DIR__.'/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. --EXPECT--
  36. Test 1
  37. int(0)
  38. array(2) {
  39. ["MYCOL1"]=>
  40. array(0) {
  41. }
  42. ["MYCOL2"]=>
  43. array(0) {
  44. }
  45. }
  46. Test 2
  47. bool(false)