fetch_row.phpt 1007 B

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