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