Annotation of embedaddon/php/ext/oci8/tests/cursor_bind.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: bind and fetch 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: // Initialization
        !            14: 
        !            15: $stmtarray = array(
        !            16:     "drop table cursor_bind_tab",
        !            17:     "create table cursor_bind_tab (id NUMBER, value VARCHAR(20))",
        !            18:     "insert into cursor_bind_tab values (1, '1')",
        !            19:     "insert into cursor_bind_tab values (1, '1')",
        !            20:     "insert into cursor_bind_tab values (1, '1')"
        !            21: );
        !            22: 
        !            23: oci8_test_sql_execute($c, $stmtarray);
        !            24: 
        !            25: $sql = "
        !            26: DECLARE
        !            27: TYPE curtype IS REF CURSOR;
        !            28: cursor_var curtype;
        !            29: BEGIN
        !            30:     OPEN cursor_var FOR SELECT id, value FROM cursor_bind_tab;
        !            31:     :curs := cursor_var;
        !            32: END;
        !            33: ";
        !            34: 
        !            35: $stmt = oci_parse($c, $sql);
        !            36: 
        !            37: $cursor = oci_new_cursor($c);
        !            38: oci_bind_by_name($stmt, ":curs", $cursor, -1, OCI_B_CURSOR);
        !            39: 
        !            40: oci_execute($stmt);
        !            41: 
        !            42: oci_execute($cursor);
        !            43: var_dump(oci_fetch_row($cursor));
        !            44: var_dump(oci_fetch_row($cursor));
        !            45: var_dump(oci_fetch_row($cursor));
        !            46: var_dump(oci_fetch_row($cursor));
        !            47: 
        !            48: // Clean up
        !            49: 
        !            50: $stmtarray = array(
        !            51:     "drop table cursor_bind_tab"
        !            52: );
        !            53: 
        !            54: oci8_test_sql_execute($c, $stmtarray);
        !            55: 
        !            56: ?>
        !            57: ===DONE===
        !            58: <?php exit(0); ?>
        !            59: --EXPECT--  
        !            60: array(2) {
        !            61:   [0]=>
        !            62:   string(1) "1"
        !            63:   [1]=>
        !            64:   string(1) "1"
        !            65: }
        !            66: array(2) {
        !            67:   [0]=>
        !            68:   string(1) "1"
        !            69:   [1]=>
        !            70:   string(1) "1"
        !            71: }
        !            72: array(2) {
        !            73:   [0]=>
        !            74:   string(1) "1"
        !            75:   [1]=>
        !            76:   string(1) "1"
        !            77: }
        !            78: bool(false)
        !            79: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>