|
<< Click to Display Table of Contents >> cbDELAYEDUPD |
![]() ![]()
|
This CallBack mechanism is invoked when the cached updates feature fails to write a modified record to the database. Because updates are not sent to the underlying table until the commit time, no errors (such as integrity constraint violation, and so on) are detected before the commit operation. If an error occurs at the commit time, you are prompted with an error message indicating what sort of error has happened. The clients should register a CallBack function for delayed updates by using the DbiRegisterCallBack function (ecbType for this CallBack is cbDELAYEDUPD) to be notified of the errors during the commit.
Here is the CallBack descriptor, cbDELAYEDUPD, for delayed updates:
// type of delayed update object (delayed updates CallBack)
typedef enum
{
delayupdNONE = 0,
delayupdMODIFY = 1,
delayupdINSERT = 2,
delayupdDELETE = 3
} DelayUpdErrOpType;
// delayed updates CallBack descriptor.
typedef struct
{
DBIResult iErrCode;
DelayUpdErrOpType eDelayUpdErrOpType;
// Record size (physical record)
UINT16 iRecBufSize;
pBYTE pNewRecBuf;
pBYTE pOldRecBuf;
} DELAYUPDCbDesc;
In the above CallBack descriptor, eDelayUpdErrOpType indicates the operation type , such as insert, delete or modify and iErrCode indicates what sort of error has occurred during the eDelayUpdErrOpType operation.
Clients should allocate enough memory for pNewRecBuf and pOldRecBuf. Each record buffer should be at least the delayed update cursor’s physical record buffer size. The new (after the update) and old (before the update) record buffers are returned to the clients through pNewRecBuf and pOldRecBuf record buffers.
Clients can respond to this CallBack function with cbrABORT, cbrSKIP, cbrCONTINUE and cbrRETRY return codes. The following actions are taken depending on the return codes.
| • | If the return code is cbrABORT, the entire commit operation is aborted. Rollback of the committed updates will occur depending on the delayed updates cursor’s property. |
| • | If the return code is cbrSKIP or cbrCONTINUE, the failed update operation is discarded and the commit process continues with the remaining updates. |
| • | If the return code is cbrRETRY, the failed update operation is tried again. |
If no CallBack function is registered, the default return code is cbrABORT.