xref: /PHP-7.1/ext/oci8/tests/bug35973.phpt (revision 37652336)
1--TEST--
2Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6require(dirname(__FILE__).'/skipif.inc');
7?>
8--FILE--
9<?php
10
11require dirname(__FILE__).'/connect.inc';
12
13$s1 = oci_parse($c, "drop table test_nclob");
14@oci_execute($s1);
15
16$s2 = oci_parse($c, "create table test_nclob (nc NCLOB)");
17oci_execute($s2);
18
19$s3 = oci_parse($c, "insert into test_nclob (nc) values ('12345data')");
20oci_execute($s3);
21
22$s3 = oci_parse($c, "select * from test_nclob");
23oci_execute($s3);
24
25var_dump($data = oci_fetch_assoc($s3));
26$d = $data['NC'];
27
28var_dump($d->read(5));
29var_dump($d->read(4));
30
31$s1 = oci_parse($c, "drop table test_nclob");
32@oci_execute($s1);
33
34echo "Done\n";
35?>
36--EXPECTF--
37array(1) {
38  ["NC"]=>
39  object(OCI-Lob)#%d (1) {
40    ["descriptor"]=>
41    resource(%d) of type (oci8 descriptor)
42  }
43}
44string(%d) "%s5"
45string(%d) "%sa"
46Done
47