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