fetch_all1.phpt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. --TEST--
  2. oci_fetch_all()
  3. --SKIPIF--
  4. <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
  5. --FILE--
  6. <?php
  7. require(dirname(__FILE__)."/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. /* ocifetchstatement */
  27. if (!oci_execute($s)) {
  28. die("oci_execute(select) failed!\n");
  29. }
  30. var_dump(ocifetchstatement($s, $all));
  31. var_dump($all);
  32. // Cleanup
  33. $stmtarray = array(
  34. "drop table fetch_all_tab"
  35. );
  36. oci8_test_sql_execute($c, $stmtarray);
  37. echo "Done\n";
  38. ?>
  39. --EXPECTF--
  40. int(3)
  41. array(2) {
  42. ["ID"]=>
  43. array(3) {
  44. [0]=>
  45. string(1) "1"
  46. [1]=>
  47. string(1) "1"
  48. [2]=>
  49. string(1) "1"
  50. }
  51. ["VALUE"]=>
  52. array(3) {
  53. [0]=>
  54. string(1) "1"
  55. [1]=>
  56. string(1) "1"
  57. [2]=>
  58. string(1) "1"
  59. }
  60. }
  61. int(3)
  62. array(2) {
  63. ["ID"]=>
  64. array(3) {
  65. [0]=>
  66. string(1) "1"
  67. [1]=>
  68. string(1) "1"
  69. [2]=>
  70. string(1) "1"
  71. }
  72. ["VALUE"]=>
  73. array(3) {
  74. [0]=>
  75. string(1) "1"
  76. [1]=>
  77. string(1) "1"
  78. [2]=>
  79. string(1) "1"
  80. }
  81. }
  82. Done