Annotation of embedaddon/php/ext/oci8/tests/cursors_old.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: fetching cursor from a statement
! 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: // Initialize
! 14:
! 15: $stmtarray = array(
! 16: "drop table cursors_old_tab",
! 17: "create table cursors_old_tab (id number, value number)",
! 18: "insert into cursors_old_tab (id, value) values (1,1)",
! 19: "insert into cursors_old_tab (id, value) values (1,1)",
! 20: "insert into cursors_old_tab (id, value) values (1,1)",
! 21: );
! 22:
! 23: oci8_test_sql_execute($c, $stmtarray);
! 24:
! 25: // Run Test
! 26:
! 27: $sql = "select cursor(select * from cursors_old_tab) as curs from dual";
! 28: $stmt = ociparse($c, $sql);
! 29:
! 30: ociexecute($stmt);
! 31:
! 32: while ($result = ocifetchinto($stmt, $data, OCI_ASSOC)) {
! 33: ociexecute($data["CURS"]);
! 34: ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
! 35: var_dump($subdata);
! 36: var_dump(ocicancel($data["CURS"]));
! 37: ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
! 38: var_dump($subdata);
! 39: var_dump(ocicancel($data["CURS"]));
! 40: }
! 41:
! 42: // Cleanup
! 43:
! 44: $stmtarray = array(
! 45: "drop table cursors_old_tab"
! 46: );
! 47:
! 48: oci8_test_sql_execute($c, $stmtarray);
! 49:
! 50: echo "Done\n";
! 51:
! 52: ?>
! 53: --EXPECTF--
! 54: array(2) {
! 55: [%u|b%"ID"]=>
! 56: %unicode|string%(1) "1"
! 57: [%u|b%"VALUE"]=>
! 58: %unicode|string%(1) "1"
! 59: }
! 60: bool(true)
! 61:
! 62: Warning: ocifetchinto():%sORA-01002: %s in %scursors_old.php on line %d
! 63: array(2) {
! 64: [%u|b%"ID"]=>
! 65: %unicode|string%(1) "1"
! 66: [%u|b%"VALUE"]=>
! 67: %unicode|string%(1) "1"
! 68: }
! 69: bool(true)
! 70: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>