Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Batch Insert Operations

The FairCom Server supports inserting a batch of records into a c-tree data file. Batch functions can even be used to load records from one file into another file of the same format.

To batch load records into a file, call DoBatchXtd() as follows:

  1. Specify the BAT_INS mode and either BAT_RET_BLK or BAT_RET_REC to indicate the format in which the records are organized in the input buffer:
    • BAT_RET_BLK denotes that the records are essentially as they would be if read directly from disk, including variable-length record header information. That is, the records are packed in the batch buffer with no intervening information between them.
    • BAT_RET_REC denotes that each record in the batch buffer is proceeded by its four-byte record byte-offset value (eight-byte for HUGE files).

    See Additional DoBatchXtd() Options for a discussion of the new BAT_RET_BLK batch read mode.

  2. For the request parameter, pass a pointer to an array of 5 LONG integers immediately followed by a buffer containing the records to be inserted.
  3. Set bufsiz to the size of this additional buffer in bytes. (Ordinarily, bufsiz specifies the size of the output buffer pointed to by bufptr, however, bufptr is ignored in calls for BAT_INS.)
  4. Only the third of the 5 LONG integers (breturn) is used on input. Set breturn to the number of records in the buffer.

On return from a BAT_INS call, only the DoBatchXtd() return value is significant.

For transaction controlled files, the batch insertion operation is treated as one all or nothing operation. If no explicit transaction is started, each BAT_INS call will start and end its own transaction. Even if an explicit transaction is started, each call to BAT_INS is treated independently through save points. One failed BAT_INS call does not invalidate prior or subsequent BAT_INS calls.

An optional mode that can be used with the BAT_INS mode is BAT_INP_RAW. Its effect is described as follows:

  • BAT_INP_RAW: In heterogeneous client/server implementations, turns off the conversion of record images, key values and record positions passed to a batch function.

Note: Currently, all calls for batch insertion (BAT_INS) behave as if BAT_INP_RAW is turned on, regardless of the actual mode parameter.