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