Beispiel #1
0
/* CloseRow
 *  balances OpenRow message
 *  if there are uncommitted modifications,
 *  discard all changes. otherwise,
 *  advance to next row
 */
rc_t VTableReadCursorCloseRow ( const VTableCursor *cself )
{
    rc_t rc;
    VTableCursor *self = ( VTableCursor* ) cself;

    if ( self == NULL )
        rc = RC ( rcVDB, rcCursor, rcClosing, rcSelf, rcNull );
    else if ( self -> dad . state < vcRowOpen )
        rc = 0;
    else
        rc = VCursorCloseRowRead ( & self -> dad );

    return rc;
}
Beispiel #2
0
/* CloseRow
 *  balances OpenRow message
 *  if there are uncommitted modifications,
 *  discard all changes. otherwise,
 *  advance to next row
 */
LIB_EXPORT rc_t CC VCursorCloseRow ( const VCursor *cself )
{
    rc_t rc;
    VCursor *self = ( VCursor* ) cself;

    if ( self == NULL )
        rc = RC ( rcVDB, rcCursor, rcClosing, rcSelf, rcNull );
    else if ( self -> state < vcRowOpen )
        rc = 0;
    else
        rc = VCursorCloseRowRead ( self );

    return rc;
}
Beispiel #3
0
/* CloseRow
 *  balances OpenRow message
 *  if there are uncommitted modifications,
 *  discard all changes. otherwise,
 *  advance to next row
 */
LIB_EXPORT rc_t CC VCursorCloseRow ( const VCursor *cself )
{
    rc_t rc = 0;        /* needed in case FlushPage isn't called */
    VCursor *self = ( VCursor* ) cself;

    if ( self == NULL )
        rc = RC ( rcVDB, rcCursor, rcClosing, rcSelf, rcNull );
    else if ( self -> state == vcFailed )
        rc = RC ( rcVDB, rcCursor, rcClosing, rcCursor, rcInvalid );
    else if ( self -> state < vcRowOpen )
        rc = 0;
    else if ( self -> read_only )
        rc = VCursorCloseRowRead ( self );
    else
    {
        /* tell each of the columns that no further data may be written
           and to abandon any uncommitted writes */
        VectorForEach ( & self -> row, false, WColumnCloseRow, NULL );

        /* if the row was committed... */
        if ( self -> state >= vcRowCommitted )
        {
            /* close off the page if so requested */
            if ( self -> state == vcPageCommit )
            {
                rc = VCursorFlushPageInt ( self );
                if ( rc )
                {
                    self -> state = vcFailed;
                    return rc;
                }
            }

            /* advance to next id */
            ++ self -> row_id;
        }

        self -> state = vcReady;
        rc = 0;
    }

    return rc;
}