imp_res_cancel.phpt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --TEST--
  2. Oracle Database 12c Implicit Result Sets: oci_cancel
  3. --EXTENSIONS--
  4. oci8
  5. --SKIPIF--
  6. <?php
  7. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  8. require(__DIR__.'/skipif.inc');
  9. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
  10. if (!(isset($matches[0]) && $matches[1] >= 12)) {
  11. die("skip expected output only valid when using Oracle Database 12c or greater");
  12. }
  13. preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
  14. if (!(isset($matches[0]) && $matches[0] >= 12)) {
  15. die("skip works only with Oracle 12c or greater version of Oracle client libraries");
  16. }
  17. ?>
  18. --FILE--
  19. <?php
  20. require(__DIR__.'/connect.inc');
  21. $stmtarray = array(
  22. "create or replace procedure imp_res_cancel_proc as
  23. c1 sys_refcursor;
  24. c2 sys_refcursor;
  25. begin
  26. open c1 for select 1 from dual union all select 2 from dual;
  27. dbms_sql.return_result(c1);
  28. open c2 for select 3 from dual;
  29. dbms_sql.return_result (c2);
  30. end;"
  31. );
  32. oci8_test_sql_execute($c, $stmtarray);
  33. // Run Test
  34. echo "Test 1\n";
  35. $s = oci_parse($c, "begin imp_res_cancel_proc(); end;");
  36. oci_execute($s);
  37. while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
  38. foreach ($row as $item) {
  39. echo " ".$item;
  40. }
  41. echo "\n";
  42. var_dump(oci_cancel($s));
  43. }
  44. // Clean up
  45. $stmtarray = array(
  46. "drop procedure imp_res_cancel_proc"
  47. );
  48. oci8_test_sql_execute($c, $stmtarray);
  49. ?>
  50. --EXPECT--
  51. Test 1
  52. 1
  53. bool(true)
  54. 2
  55. bool(true)
  56. 3
  57. bool(true)