Product Documentation

c-treeACE V10.3 Update Guide

Previous Topic

Next Topic

Batch Update Operations: BAT_UPD and BAT_UPD_KEY

The batch update call to DoBatchXtd() (short name BATSETX) is formatted as follows:

BATSETX(keyno,request,NULL,bufsiz,mode)

Where the parameters are:

  • keyno - Index file number of a unique index associated with the target data file
  • request
    • Input buffer comprised of 5 LONG integers followed by the record entries as described above. On input, ((pLONG)request)[2] holds the number of entries.
    • Output buffer comprised of 5 LONG integers:

    0) successful rewrites

    1) successful adds

    2) reserved for future use

    3) in case of error, offset into the input buffer for the entry causing the error (zero offset is just after the 5 LONG integers)

    4) a 32-bit status word that indicates what operation failed (see BAT_STT_XXXX in ctport.h):

Symbolic name

Value

Description

BAT_STT_UPDATE

0x00000001

error on rewrite

BAT_STT_ADD

0x00000002

error on insertion

BAT_STT_DELETE

0x00000004

error on delete

BAT_STT_REDIREC

0x00000008

error on reading old record

BAT_STT_EQLKEY

0x00000010

error on equal key

BAT_STT_BUFSIZ

0x00000020

record image area too small

BAT_STT_FRMKEY

0x00000040

error assembling or transforming unique key value

BAT_STT_GTVLEN

0x00000080

error on get var rec length

BAT_STT_GETMEM

0x00000100

error allocating record buf

BAT_STT_CONVERT

0x00000200

error converting rec image

  • bufsiz - Size of the input buffer region that follows the 5 LONG integers
  • mode - BAT_UPD or (BAT_UPD | BAT_UPD_KEY).

Error Handling

BATSETX() returns an error code or NO_ERROR. This operation will stop if an error occurs. In case of an error, the number of successful Updates and ADDs are returned in elements 0 and 1 of the request output buffer as described above.

Because the operation stops on the first record that fails, adding the number of Updates and number of ADDs gives you the record number that failed.

Transaction Control - If an error occurs when the files are transaction controlled, none of the successful updates will be committed since BAT_UPD starts a transaction if one is not active or a save point if a transaction is active. In the event of an error, it either aborts the transaction or restores to the save point. For files that are not transaction controlled, the successful updates survive the error.

Status Word Zero - If an error code is returned and the status word is zero, the error occurred during the setup of the BAT_UPD and no attempts were made to update any records.

Limitations

See Heterogeneous support for BAT_INS and BAT_UPD.

TOCIndex