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