Exemple #1
0
BOOL Find( IN JET_TABLEID TableId, IN PWCHAR Name)
{
    JET_ERR     JetError;

    JetError = JetMove( SesId, TableId, JET_MoveFirst, 0);
    if ( JetError != JET_errSuccess) {
        RplAssert( TRUE, ("JetMove failed err=%d", JetError));
        return( FALSE);
    }
    JetError = JetMakeKey( SesId, TableId, Name,
            ( wcslen( Name) + 1) * sizeof(WCHAR), JET_bitNewKey);
    if ( JetError != JET_errSuccess) {
        RplAssert( TRUE, ("MakeKey failed err=%d", JetError));
        return( FALSE);
    }
    JetError = JetSeek( SesId, TableId, JET_bitSeekEQ);
    if ( JetError != JET_errSuccess) {
        if ( JetError == JET_errRecordNotFound) {
            //
            //  This is an expected error => no break for this.
            //
            RplDbgPrint(("JetSeek for %ws failed with error = %d.\n", Name, JetError));
        } else {
            RplAssert( TRUE, ("JetSeek failed err=%d", JetError));
        }
        return( FALSE);
    }
    return( TRUE);
}
Exemple #2
0
BOOL ResumeKeyGet(
    IN      PRPL_SESSION    pSession,
    IN      DWORD           ResumeHandle,
    OUT     PVOID           ResumeValue,
    IN OUT  PDWORD          pResumeSize
    )
{
    DWORD       DataSize;
#ifdef RPL_DEBUG_NEVER
    if ( RG_DebugLevel == (DWORD)(-1)) {
        ResumeList( pSession, "++ResumeKeyGet");
    }
#endif // RPL_DEBUG_NEVER
    CallB( JetSetCurrentIndex( pSession->SesId, pSession->ResumeTableId, RESUME_INDEX_ResumeHandle));
    CallB( JetMakeKey( pSession->SesId, pSession->ResumeTableId, &ResumeHandle,
            sizeof( ResumeHandle), JET_bitNewKey));
    CallB( JetSeek( pSession->SesId, pSession->ResumeTableId, JET_bitSeekEQ));
    CallB( JetRetrieveColumn( pSession->SesId, pSession->ResumeTableId,
        ResumeTable[ RESUME_ResumeValue].ColumnId, ResumeValue,
        *pResumeSize, &DataSize, 0, NULL));
    if ( DataSize > *pResumeSize) {
        RplDump( ++RG_Assert, ( "DataSize=%d", DataSize));
        return( FALSE);
    }
    *pResumeSize = DataSize;
    return( TRUE);
}
Exemple #3
0
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
}
Exemple #4
0
HRESULT Table::Seek(JET_GRBIT flags)
{
    const JET_ERR jetErr = JetSeek(sesId_, tableId_, flags);
    if (jetErr != JET_errSuccess)
    {
        SetLastErrorDesc(Error("JetSeek", jetErr, __FUNCTION__));
        switch (jetErr)
        {
        case JET_errRecordNotFound:
            return E_RECORD_NOT_FOUND;
        case JET_wrnSeekNotEqual:
            return E_SEEK_NOT_EQUAL;
        }                
        return E_FAIL;
    }
    return S_OK;
}