예제 #1
0
파일: wtable.c 프로젝트: binlu1981/ncbi-vdb
/* ListColumns
 *  list writable column names
 *
 *  "names" [ OUT ] - return parameter for namelist
 *
 *  availability: v2.1
 */
static
rc_t list_writable_columns ( VTable *self )
{
    rc_t rc;
    VCursor *curs;

    if ( self -> read_only )
    {
        self -> write_col_cache_valid = true;
        return 0;
    }

    rc = VTableCreateCursorWriteInt ( self, & curs, kcmInsert, false );
    if (  rc == 0 )
    {
	/* no need for schema-based triggers to fire **/
	VCursorSuspendTriggers ( curs );
        /* let this private VCursor-function list the columns */
        rc = VCursorListWritableColumns ( curs, & self -> write_col_cache );
        VCursorRelease ( curs );
        if ( rc == 0 )
            self -> write_col_cache_valid = true;
    }

    return rc;
}
예제 #2
0
파일: wtable.c 프로젝트: binlu1981/ncbi-vdb
LIB_EXPORT rc_t CC VTableListSeededWritableColumns ( VTable *self,
    KNamelist **names, const KNamelist *seed )
{
    rc_t rc;

    if ( names == NULL )
        rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
    else
    {
        * names = NULL;

        if ( self == NULL )
            rc = RC ( rcVDB, rcTable, rcListing, rcSelf, rcNull );
        else if ( seed == NULL )
            rc = RC ( rcVDB, rcTable, rcListing, rcParam, rcNull );
        else
        {
            BSTree cache;
            BSTreeInit ( & cache );

            rc = 0;

            if ( ! self -> read_only )
            {
                VCursor *curs;
                rc = VTableCreateCursorWriteInt ( self, & curs, kcmInsert, false );
                if (  rc == 0 )
                {
                    /* let this private VCursor-function list the columns */
                    rc = VCursorListSeededWritableColumns ( curs, & cache, seed );
                    VCursorRelease ( curs );
                }
            }

            if ( rc == 0 )
                rc = make_column_namelist ( & cache, names );

            BSTreeWhack ( & cache, VColumnRefWhack, NULL );
        }
    }

    return rc;
}
예제 #3
0
LIB_EXPORT rc_t CC VTableCreateCursorWrite ( VTable *self, VCursor **cursp, KCreateMode mode )
{
    return VTableCreateCursorWriteInt ( self, cursp, mode, true );
}