fetch_all1.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. --TEST--
  2. oci_fetch_all()
  3. --EXTENSIONS--
  4. oci8
  5. --FILE--
  6. <?php
  7. require(__DIR__."/connect.inc");
  8. // Initialize
  9. $stmtarray = array(
  10. "drop table fetch_all_tab",
  11. "create table fetch_all_tab (id number, value number)",
  12. "insert into fetch_all_tab (id, value) values (1,1)",
  13. "insert into fetch_all_tab (id, value) values (1,1)",
  14. "insert into fetch_all_tab (id, value) values (1,1)"
  15. );
  16. oci8_test_sql_execute($c, $stmtarray);
  17. if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
  18. die("oci_parse(select) failed!\n");
  19. }
  20. /* oci_fetch_all */
  21. if (!oci_execute($s)) {
  22. die("oci_execute(select) failed!\n");
  23. }
  24. var_dump(oci_fetch_all($s, $all));
  25. var_dump($all);
  26. // Cleanup
  27. $stmtarray = array(
  28. "drop table fetch_all_tab"
  29. );
  30. oci8_test_sql_execute($c, $stmtarray);
  31. echo "Done\n";
  32. ?>
  33. --EXPECT--
  34. int(3)
  35. array(2) {
  36. ["ID"]=>
  37. array(3) {
  38. [0]=>
  39. string(1) "1"
  40. [1]=>
  41. string(1) "1"
  42. [2]=>
  43. string(1) "1"
  44. }
  45. ["VALUE"]=>
  46. array(3) {
  47. [0]=>
  48. string(1) "1"
  49. [1]=>
  50. string(1) "1"
  51. [2]=>
  52. string(1) "1"
  53. }
  54. }
  55. Done