xref: /PHP-8.3/ext/oci8/tests/lob_016.phpt (revision a53e5617)
1--TEST--
2returning multiple lobs
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';
15
16$drop = "DROP table lob_test";
17$statement = oci_parse($c, $drop);
18@oci_execute($statement);
19
20$create = "CREATE table lob_test(lob_1 BLOB, lob_2 BLOB)";
21$statement = oci_parse($c, $create);
22oci_execute($statement);
23
24$init = "INSERT INTO lob_test VALUES(EMPTY_BLOB(), EMPTY_BLOB())";
25$statement = oci_parse($c, $init);
26oci_execute($statement);
27
28$select = "SELECT * FROM lob_test FOR UPDATE";
29$statement = oci_parse($c, $select);
30oci_execute($statement, OCI_DEFAULT);
31
32$row = oci_fetch_assoc($statement);
33
34$row['LOB_1']->write("first");
35$row['LOB_2']->write("second");
36
37unset($row);
38
39oci_commit($c);
40
41$select = "SELECT * FROM lob_test FOR UPDATE";
42$statement = oci_parse($c, $select);
43oci_execute($statement, OCI_DEFAULT);
44
45$row = oci_fetch_assoc($statement);
46
47var_dump($row);
48var_dump($row['LOB_1']->load());
49var_dump($row['LOB_2']->load());
50
51$drop = "DROP table lob_test";
52$statement = oci_parse($c, $drop);
53@oci_execute($statement);
54
55echo "Done\n";
56
57?>
58--EXPECTF--
59array(2) {
60  ["LOB_1"]=>
61  object(OCILob)#%d (1) {
62    ["descriptor"]=>
63    resource(%d) of type (oci8 descriptor)
64  }
65  ["LOB_2"]=>
66  object(OCILob)#%d (1) {
67    ["descriptor"]=>
68    resource(%d) of type (oci8 descriptor)
69  }
70}
71string(5) "first"
72string(6) "second"
73Done
74