xref: /PHP-8.1/ext/oci8/tests/lob_039.phpt (revision b5a14e6c)
1--TEST--
2Test CLOB->write() for multiple inserts
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
8require(__DIR__.'/skipif.inc');
9?>
10--FILE--
11<?php
12
13require __DIR__.'/connect.inc';
14require __DIR__.'/create_table.inc';
15
16echo "Test 1: CLOB\n";
17
18$ora_sql = "INSERT INTO
19                       ".$schema.$table_name." (clob)
20                      VALUES (empty_clob())
21                      RETURNING
22                               clob
23                      INTO :v_clob ";
24
25$s = oci_parse($c,$ora_sql);
26$clob = oci_new_descriptor($c,OCI_DTYPE_LOB);
27
28
29oci_bind_by_name($s,":v_clob", $clob,-1,OCI_B_CLOB);
30
31oci_execute($s, OCI_DEFAULT);
32var_dump($clob->write("clob test 1"));
33
34oci_execute($s, OCI_DEFAULT);
35var_dump($clob->write("clob test 2"));
36
37oci_execute($s, OCI_DEFAULT);
38var_dump($clob->write("clob test 3"));
39
40$s = oci_parse($c,"select clob from ".$schema.$table_name);
41var_dump(oci_execute($s));
42
43oci_fetch_all($s, $res);
44
45var_dump($res);
46
47
48require __DIR__.'/drop_table.inc';
49
50echo "Done\n";
51
52?>
53--EXPECT--
54Test 1: CLOB
55int(11)
56int(11)
57int(11)
58bool(true)
59array(1) {
60  ["CLOB"]=>
61  array(3) {
62    [0]=>
63    string(11) "clob test 1"
64    [1]=>
65    string(22) "           clob test 2"
66    [2]=>
67    string(33) "                      clob test 3"
68  }
69}
70Done
71