/* OpenParent * duplicate reference to parent table * NB - returned reference must be released */ LIB_EXPORT rc_t CC VCursorOpenParentUpdate ( VCursor *self, VTable **tbl ) { rc_t rc; if ( tbl == NULL ) rc = RC ( rcVDB, rcCursor, rcAccessing, rcParam, rcNull ); else { if ( self == NULL ) rc = RC ( rcVDB, rcCursor, rcAccessing, rcSelf, rcNull ); else if ( self -> tbl -> read_only ) rc = RC ( rcVDB, rcCursor, rcAccessing, rcTable, rcReadonly ); else { rc = VTableAddRef ( self -> tbl ); if ( rc == 0 ) { * tbl = self -> tbl; return 0; } } * tbl = NULL; } return rc; }
/* semi-private for sra-dbcc */ LIB_EXPORT rc_t CC SRATableGetVTableRead( const SRATable *self, const VTable **rslt ) { if (rslt == NULL) return RC(rcSRA, rcTable, rcAccessing, rcParam, rcNull); if (self == NULL) { * rslt = NULL; return RC(rcSRA, rcTable, rcAccessing, rcSelf, rcNull); } *rslt = self->vtbl; return VTableAddRef(*rslt); }
/* SetTable * call it if you work with Table * * "path" [ IN ] - path to the table that is used to access it */ LIB_EXPORT rc_t CC ReportResetTable ( const char *path, const VTable *tbl ) { rc_t rc = 0; Report* self = NULL; ReportGet(&self); if ( self != NULL ) { rc = VTableAddRef ( tbl ); if ( rc == 0 ) { VDatabaseRelease ( self -> db ), self -> db = NULL; VTableRelease ( self -> table ); self -> table = tbl; } } return rc; }