Пример #1
0
LIB_EXPORT rc_t CC KDBManagerOpenTableRead ( const KDBManager *self,
    const KTable **tbl, const char *path, ... )
{
    rc_t rc;
    va_list args;

    va_start ( args, path );
    rc = KDBManagerVOpenTableRead ( self, tbl, path, args );
    va_end ( args );

    return rc;
}
Пример #2
0
/* OpenTableRead
 * VOpenTableRead
 *  open a table for read
 *
 *  "tbl" [ OUT ] - return parameter for newly opened table
 *
 *  "path" [ IN ] - NUL terminated string in
 *  wd-native character set giving path to table
 */
LIB_EXPORT rc_t CC VDBManagerVOpenTableRead ( const VDBManager *self,
    const VTable **tblp, const VSchema *schema,
    const char *path, va_list args )
{
    rc_t rc;

    if ( tblp == NULL )
        rc = RC ( rcVDB, rcMgr, rcOpening, rcParam, rcNull );
    else
    {
        if ( self == NULL )
            rc = RC ( rcVDB, rcMgr, rcOpening, rcSelf, rcNull );
        else
        {
            VTable *tbl;

            /* if no schema is given, always pass intrinsic */
            if ( schema == NULL )
                schema = self -> schema;

            rc = VTableMake ( & tbl, self, NULL, schema );
            if ( rc == 0 )
            {
                tbl -> read_only = true;
                rc = KDBManagerVOpenTableRead ( self -> kmgr, & tbl -> ktbl, path, args );
                if ( rc == 0 )
                {
                    rc = VTableOpenRead ( tbl );
                    if ( rc == 0 )
                    {
#if LAZY_OPEN_COL_NODE
                        KMDataNodeRelease ( tbl -> col_node );
                        tbl -> col_node = NULL;
#endif
                        * tblp = tbl;
                        return 0;
                    }
                }
                VTableWhack ( tbl );
            }
        }

        * tblp = NULL;
    }

    return rc;
}