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