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