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