Btrieve Clients
A Btrieve client is an application-defined entity that makes Btrieve calls. Each client can make Btrieve calls and has its own resources (such as files) that are registered with the MicroKernel. In addition, the MicroKernel maintains the status of transactions (both exclusive and concurrent) on a per-client basis.
When you need to support multiple clients concurrently, use the BTRVID or BTRCALLID function, which includes a Client ID parameter. The Client ID parameter is the address of a 16-byte structure that allows the MicroKernel to differentiate among the clients on a computer. Following are examples of situations in which using a Client ID might be useful:
The MicroKernel provides several concurrency control methods and uses several implementation tools to resolve conflicts that can occur when multiple clients attempt to access or modify records in the same file concurrently.
The concurrency control methods are as follows:
The implementation tools are as follows:
The following sections discuss the MicroKernel’s concurrency control methods in detail. While reading each of the sections, refer to Table 35. This table summarizes the types of conflicts that can occur when two clients attempt to access or modify the same file. Table 35 describes the actions of local clients.
*Note: If your application uses the BTRVID function to define and manage multiple clients within the same application, such clients are considered local clients.
In both tables, client 1 performs an action identified by an abbreviation in the far-left column of the table, and then client 2 attempts to perform one of the actions identified by an abbreviation in the top row of the table.
The actions represented by the abbreviations are described in Action Codes.
Assumptions
Table 35 assumes the following:
Action Codes
 
Conflict Codes
 
For conflict codes RB, PB, and FB, the MicroKernel retries client 2’s action unless client 2 has specified a no-wait type operation (for example, a read with a no-wait lock or an insert/modify in a concurrent transaction that was started with a 500 bias). For a no-wait operation, the MicroKernel returns an error status code.
 
Following are examples for interpreting action code combinations in Table 35: