xref: /PHP-8.2/ext/oci8/tests/bug32325.phpt (revision b5a14e6c)
1--TEST--
2Bug #32325 (Cannot retrieve collection using OCI8)
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// Initialize
16
17$stmtarray = array(
18    "create or replace type bug32325_t as table of number"
19);
20
21oci8_test_sql_execute($c, $stmtarray);
22
23// Run test
24
25$collection = oci_new_collection($c, "BUG32325_T");
26
27$sql = "begin
28        select bug32325_t(1,2,3,4) into :list from dual;
29        end;";
30
31$stmt = oci_parse($c, $sql);
32
33oci_bind_by_name($stmt, ":list",  $collection, -1, OCI_B_NTY);
34oci_execute($stmt);
35
36var_dump($collection->size());
37var_dump($collection->getelem(1));
38var_dump($collection->getelem(2));
39
40// Cleanup
41
42$stmtarray = array(
43    "drop type bug32325_t"
44);
45
46oci8_test_sql_execute($c, $stmtarray);
47
48echo "Done\n";
49?>
50--EXPECT--
51int(4)
52float(2)
53float(3)
54Done
55