Annotation of embedaddon/php/ext/oci8/tests/bug40078.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name())
! 3: --SKIPIF--
! 4: <?php
! 5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
! 6: require(dirname(__FILE__).'/skipif.inc');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10:
! 11: require dirname(__FILE__).'/connect.inc';
! 12:
! 13: $create_pkg = "
! 14: CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
! 15: TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
! 16: PROCEDURE nullbind(c1 OUT ARRTYPE);
! 17: END ARRAYBINDPKG1;";
! 18: $statement = oci_parse($c, $create_pkg);
! 19: oci_execute($statement);
! 20:
! 21: $create_pkg_body = "
! 22: CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
! 23: PROCEDURE nullbind(c1 OUT ARRTYPE) IS
! 24: BEGIN
! 25: c1(1) := 'one';
! 26: c1(2) := 'two';
! 27: c1(3) := '';
! 28: c1(4) := 'four';
! 29: c1(5) := 'five';
! 30: END nullbind;
! 31: END ARRAYBINDPKG1;";
! 32: $statement = oci_parse($c, $create_pkg_body);
! 33: oci_execute($statement);
! 34:
! 35: $statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.nullbind(:c1); END;");
! 36:
! 37: oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);
! 38:
! 39: oci_execute($statement);
! 40:
! 41: var_dump($array);
! 42:
! 43: echo "Done\n";
! 44: ?>
! 45: --EXPECTF--
! 46: array(5) {
! 47: [0]=>
! 48: string(3) "one"
! 49: [1]=>
! 50: string(3) "two"
! 51: [2]=>
! 52: string(0) ""
! 53: [3]=>
! 54: string(4) "four"
! 55: [4]=>
! 56: string(4) "five"
! 57: }
! 58: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>