Idle Method

      Applies To

Suspends data processing, enabling the Microsoft Jet database engine to complete any pending tasks, such as memory optimization or page timeouts (Microsoft Jet workspaces only).

Syntax

VOIDIdle(LONG lOptions = -1);

Parameters

Type Argument Description
LONG IOptions Optional. Specify dbRefreshCache to force any pending writes to .mdb files, and refresh memory with the most current data from the .mdb file.

Remarks

The Idle method allows the Microsoft Jet database engine to perform background tasks that may not be up-to-date because of intense data processing. This is often true in multiuser, multitasking environments that don't have enough background processing time to keep all records in a CdbRecordset current.

Usually, read locks are removed and data in local dynaset-type Recordset objects are updated only when no other actions (including mouse movements) occur. If you periodically use the Idle method, Microsoft Jet can catch up on background processing tasks by releasing unneeded read locks.

Specifying the optional dbRefreshCache argument forces any pending writes to .mdb files, and refreshes memory with the most current data from the .mdb file.

You don't need to use this method in single-user environments unless multiple instances of an application are running. The Idle method may increase performance in a multiuser environment because it forces the database engine to write data to disk, releasing locks on memory.

Note You can also release read locks by making operations part of a transaction.

Usage

#include <afxole.h>
#include <dbdao.h>
CdbDBEngine   dben;
dben.Idle(dbRefreshCache);      // Give time to the engine.