PreviousBtrieve API Guide (9.1 revision 1) Next

Get Direct/Record (23)

Show this topic in Library frames

The Get Direct/Record operation (B_GET_DIRECT) retrieves a record using its physical location in the file instead of using one of the defined key paths.

Use Get Direct/Record to accomplish the following:

Parameters

 
Op Code
Pos Block
Data Buf
Data Buf Len
Key Buffer
Key Number
Sent

 

Returned
 

 


Note
The Key Number parameter is not needed when performing a Get Direct/Record operation on a data-only file.
Prerequisites
Procedure
  1. Set the Operation Code to 23. Optionally, you can include a lock bias:
    • +100-Single wait record lock.
    • +200-Single no-wait record lock.
    • +300-Multiple wait record lock.
    • +400-Multiple no-wait record lock.
    • For more information about locking, refer to the Pervasive.SQL Programmer's Guide.

  2. Pass the Position Block for the file.
  3. Store the 4-byte position of the requested record in the first 4 bytes of the Data Buffer.
  4. Set the Data Buffer Length to a value greater than or equal to the length of the record to retrieve.
  5. Set the Key Number to the key number of the path for which you want the MicroKernel to establish logical currency. Specify -1 if you do not want the MicroKernel to establish logical currency. To use the system-defined log key (also called system data), specify 125.
Result

If the Get Direct/Record operation is successful, the MicroKernel returns the requested record in the Data Buffer, the length of the record in the Data Buffer Length parameter, and the key value for the specified key path in the Key Buffer.

If the Get Direct/Record operation is unsuccessful and the MicroKernel cannot return the requested record, the MicroKernel returns one of the following status codes:

22

The data buffer parameter is too short. (Logical currency is still established.)

43

The specified record address is invalid. (Logical currency is not established.)

44

The specified key path is invalid. (Logical currency is not established.)

82

The MicroKernel lost positioning. (Logical currency is not established.)

Positioning

The Get Direct/Record operation erases any existing logical currency information and establishes the new logical currency according to the Key Number specified. It has no effect on the physical currency information.


Chapter contents
Publication contents

Prev topic: Get Direct/Chunk (23)
Next topic: Get Directory (18)