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