HRESULT Table::DeleteCurrentRecord() { const JET_ERR jetErr = JetDelete(sesId_, tableId_); if (jetErr != JET_errSuccess) { SetLastErrorDesc(Error("JetDelete", jetErr, __FUNCTION__)); return E_FAIL; } return S_OK; }
VOID ResumePrune( IN PRPL_SESSION pSession, IN DWORD ServerHandle ) /*++ This function returns no errors, since failure to delete old resume handles is not considered fatal (and there is very little we can do about this). --*/ { JET_ERR JetError; #ifdef RPL_DEBUG if ( RG_DebugLevel == (DWORD)(-1)) { ResumeList( pSession, "++ResumePrune"); } #endif // RPL_DEBUG CallR( JetSetCurrentIndex( pSession->SesId, pSession->ResumeTableId, RESUME_INDEX_ServerHandle)); CallR( JetMakeKey( pSession->SesId, pSession->ResumeTableId, &ServerHandle, sizeof( ServerHandle), JET_bitNewKey)); #ifdef NOT_YET JetError = JetSeek( pSession->SesId, pSession->ResumeTableId, JET_bitSeekEQ); #else JetError = JetSeek( pSession->SesId, pSession->ResumeTableId, JET_bitSeekEQ | JET_bitSetIndexRange); #endif if ( JetError == JET_errSuccess) { #ifdef NOT_YET CallR( JetMakeKey( pSession->SesId, pSession->ResumeTableId, &ServerHandle, sizeof( ServerHandle), JET_bitNewKey)); CallR( JetSetIndexRange( pSession->SesId, pSession->ResumeTableId, JET_bitRangeInclusive | JET_bitRangeUpperLimit)); #endif do { Call( JetDelete( pSession->SesId, pSession->ResumeTableId)); JetError = JetMove( pSession->SesId, pSession->ResumeTableId, JET_MoveNext, 0); } while ( JetError == JET_errSuccess); } #ifdef RPL_DEBUG if ( RG_DebugLevel == (DWORD)(-1)) { ResumeList( pSession, "--ResumePrune"); } #endif // RPL_DEBUG }
NET_API_STATUS NET_API_FUNCTION NetrRplVendorDel( IN RPL_HANDLE ServerHandle, IN LPWSTR VendorName ) /*++ If VendorName is provided then delete matching record, else delete all adapter records. --*/ { DWORD Error; PRPL_SESSION pSession = &RG_ApiSession; if ( !ValidHexName( VendorName, RPL_VENDOR_NAME_LENGTH, TRUE)) { return( ERROR_INVALID_PARAMETER); } _wcsupr( VendorName); EnterCriticalSection( &RG_ProtectDatabase); Call( JetBeginTransaction( pSession->SesId)); if ( !RplFind( pSession, VENDOR_TABLE_TAG, VendorName)) { Error = NERR_RplVendorNotFound; goto cleanup; } CallJ( JetDelete( pSession->SesId, pSession->VendorTableId)); Error = NO_ERROR; cleanup: if ( Error == NO_ERROR) { Call( JetCommitTransaction( pSession->SesId, JET_bitCommitFlush)); } else { Call( JetRollback( pSession->SesId, JET_bitRollbackAll)); } LeaveCriticalSection( &RG_ProtectDatabase); return( Error); }