//***************************************************************************** // Apply a delta record to a table, generically. //***************************************************************************** __checkReturn HRESULT CMiniMdRW::ApplyTableDelta( CMiniMdRW &mdDelta, // Interface to MD with the ENC delta. ULONG ixTbl, // Table index to update. RID iRid, // RID of the changed item. int fc) // Function code of update. { HRESULT hr = S_OK; void *pRec; // Record in existing MetaData. void *pDeltaRec; // Record if Delta MetaData. RID newRid; // Rid of new record. // Get the delta record. IfFailGo(mdDelta.GetDeltaRecord(ixTbl, iRid, &pDeltaRec)); // Get the record from the base metadata. if (iRid > m_Schema.m_cRecs[ixTbl]) { // Added record. Each addition is the next one. _ASSERTE(iRid == m_Schema.m_cRecs[ixTbl] + 1); switch (ixTbl) { case TBL_TypeDef: IfFailGo(AddTypeDefRecord(reinterpret_cast<TypeDefRec **>(&pRec), &newRid)); break; case TBL_Method: IfFailGo(AddMethodRecord(reinterpret_cast<MethodRec **>(&pRec), &newRid)); break; case TBL_EventMap: IfFailGo(AddEventMapRecord(reinterpret_cast<EventMapRec **>(&pRec), &newRid)); break; case TBL_PropertyMap: IfFailGo(AddPropertyMapRecord(reinterpret_cast<PropertyMapRec **>(&pRec), &newRid)); break; default: IfFailGo(AddRecord(ixTbl, &pRec, &newRid)); break; } IfNullGo(pRec); _ASSERTE(iRid == newRid); } else { // Updated record. IfFailGo(getRow(ixTbl, iRid, &pRec)); } // Copy the record info. IfFailGo(ApplyRecordDelta(mdDelta, ixTbl, pDeltaRec, pRec)); ErrExit: return hr; } // CMiniMdRW::ApplyTableDelta