bug46994.phpt 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --TEST--
  2. Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored procedure)
  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. ?>
  10. --FILE--
  11. <?php
  12. require(__DIR__.'/connect.inc');
  13. // Initialization
  14. $stmtarray = array(
  15. "create or replace procedure bug46994_proc1(p1 in out nocopy clob) is
  16. begin
  17. dbms_lob.trim(p1, 0);
  18. dbms_lob.writeappend(p1, 26, 'This should be the output.');
  19. end bug46994_proc1;",
  20. "create or replace procedure bug46994_proc2(p1 in out nocopy clob) is
  21. begin
  22. dbms_lob.trim(p1, 0);
  23. dbms_lob.writeappend(p1, 37, 'The output should be even longer now.');
  24. end bug46994_proc2;"
  25. );
  26. oci8_test_sql_execute($c, $stmtarray);
  27. // Run Test
  28. $myclob = oci_new_descriptor($c, OCI_D_LOB);
  29. $myclob->writeTemporary("some data", OCI_TEMP_CLOB);
  30. echo "Test 1\n";
  31. $s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
  32. oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
  33. oci_execute($s, OCI_DEFAULT);
  34. var_dump($myclob->load());
  35. echo "Test 2\n";
  36. $s = oci_parse($c, "begin bug46994_proc2(:myclob); end;");
  37. oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
  38. oci_execute($s, OCI_DEFAULT);
  39. var_dump($myclob->load());
  40. echo "Test 3\n";
  41. $s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
  42. oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
  43. oci_execute($s, OCI_DEFAULT);
  44. var_dump($myclob->load());
  45. echo "Test 4\n";
  46. var_dump($myclob->load()); // Use cached size code path
  47. // Cleanup
  48. $stmtarray = array(
  49. "drop procedure bug46994_proc1",
  50. "drop procedure bug46994_proc2"
  51. );
  52. oci8_test_sql_execute($c, $stmtarray);
  53. oci_close($c);
  54. ?>
  55. --EXPECT--
  56. Test 1
  57. string(26) "This should be the output."
  58. Test 2
  59. string(37) "The output should be even longer now."
  60. Test 3
  61. string(26) "This should be the output."
  62. Test 4
  63. string(26) "This should be the output."