Annotation of embedaddon/php/ext/oci8/tests/bug46994.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored procedure)
3: --SKIPIF--
4: <?php
5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
6: require(dirname(__FILE__).'/skipif.inc');
7: ?>
8: --FILE--
9: <?php
10:
11: require(dirname(__FILE__).'/connect.inc');
12:
13: // Initialization
14:
15: $stmtarray = array(
16: "create or replace procedure bug46994_proc1(p1 in out nocopy clob) is
17: begin
18: dbms_lob.trim(p1, 0);
19: dbms_lob.writeappend(p1, 26, 'This should be the output.');
20: end bug46994_proc1;",
21: "create or replace procedure bug46994_proc2(p1 in out nocopy clob) is
22: begin
23: dbms_lob.trim(p1, 0);
24: dbms_lob.writeappend(p1, 37, 'The output should be even longer now.');
25: end bug46994_proc2;"
26: );
27:
28: oci8_test_sql_execute($c, $stmtarray);
29:
30: // Run Test
31:
32: $myclob = oci_new_descriptor($c, OCI_D_LOB);
33: $myclob->writeTemporary("some data", OCI_TEMP_CLOB);
34:
35: echo "Test 1\n";
36:
37: $s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
38: oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
39: oci_execute($s, OCI_DEFAULT);
40: var_dump($myclob->load());
41:
42: echo "Test 2\n";
43:
44: $s = oci_parse($c, "begin bug46994_proc2(:myclob); end;");
45: oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
46: oci_execute($s, OCI_DEFAULT);
47: var_dump($myclob->load());
48:
49: echo "Test 3\n";
50:
51: $s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
52: oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
53: oci_execute($s, OCI_DEFAULT);
54: var_dump($myclob->load());
55:
56: echo "Test 4\n";
57:
58: var_dump($myclob->load()); // Use cached size code path
59:
60: // Cleanup
61:
62: $stmtarray = array(
63: "drop procedure bug46994_proc1",
64: "drop procedure bug46994_proc2"
65: );
66:
67: oci8_test_sql_execute($c, $stmtarray);
68:
69: oci_close($c);
70:
71: ?>
72: ===DONE===
73: <?php exit(0); ?>
74: --EXPECTF--
75: Test 1
76: string(26) "This should be the output."
77: Test 2
78: string(37) "The output should be even longer now."
79: Test 3
80: string(26) "This should be the output."
81: Test 4
82: string(26) "This should be the output."
83: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>