PreviousBtrieve API Guide (9.1 revision 1) Next

Get Previous Extended (37)

Show this topic in Library frames

The Get Previous Extended operation (B_GET_PREV_EXTENDED) examines one or more records, starting at the logical previous position and proceeding toward the beginning of the file, based on the specified key. It checks to see if the examined record or records satisfy a filtering condition, and it retrieves the ones that do. The filtering condition is a logic expression and is not limited to key fields only.

Get Previous Extended can also extract specified portions of records and return only those portions to an application.

Parameters

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

Returned
 

 

Prerequisites
Procedure
  1. Set the Operation Code to 37. 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. Specify a large enough Data Buffer to accommodate either the input Data Buffer or the returned Data Buffer, whichever is larger. Initialize the Data Buffer according to the structure shown in Table 2-14.
  4. Specify the Data Buffer Length as either the length of the input structure (Table 2-14) or the length of the returned structure (Table 2-15), whichever is larger.
  5. The MicroKernel sets up a buffer as a workspace for extended operations. You configure the size of this buffer using the Extended Operation Buffer Size option. The sum of the Data Buffer structure, plus the longest record to be retrieved, plus 355 bytes of requester overhead, cannot exceed the configured buffer size. (Requester overhead is not applicable in DOS workstation engines.)

  6. Specify the key value from the previous operation in the Key Buffer. Pass the Key Buffer exactly as the MicroKernel returned it on the previous call, because the MicroKernel may need the information previously stored there to determine its current position in the file.
  7. Set the Key Number parameter to the key path used on the previous call. You cannot change key paths using a Get Previous Extended operation.
Details

This operation uses the same input and returned Data Buffers as the Get Next Extended operation. Refer to Details for more information.

Result

This operation returns the same results as the Get Next Extended operation. Refer to Result for more information.

Positioning

The Get Previous Extended operation establishes the complete logical and physical currencies. The last record examined becomes the current record. This record can be either a record that satisfies the filtering condition and is retrieved, or a record that does not satisfy the filtering condition and is rejected.


Note
The MicroKernel does not allow Delete or Update operations after a Get Previous Extended operation. Because the current record is the last record examined, there is no way to ensure that your application would delete or update the intended record.

Chapter contents
Publication contents

Prev topic: Get Previous (7)
Next topic: Insert (2)