8.30 GET_OPERATION_TYPE

Valid For

Extract and Replicat

Description

Use the GET_OPERATION_TYPE function to determine the operation type associated with a record. Knowing the operation type can be useful in a user exit. For example, the user exit can perform complex validations any time a delete is encountered. It also is important to know when a compressed record is being processed if the user exit is manipulating the full data record.

As an alternative, you can use the GET_RECORD_BUFFER function to determine the operation type (see "GET_RECORD_BUFFER").

Syntax

#include "usrdecs.h"
short result_code;
record_def record;
ERCALLBACK (GET_OPERATION_TYPE, &record, &result_code);

Buffer

typedef struct
{
char *table_name;
char *buffer;
long length;
char before_after_ind;
short io_type;
short record_type;
short transaction_ind;
int64_t timestamp;
exit_ts_str io_datetime;
short mapped;
short source_or_target;
/* Version 2 CALLBACK_STRUCT_VERSION   */
char requesting_before_after_ind;
} record_def;

Input

source_or_target

One of the following indicating whether to return the operation type for the source or the target data record.

EXIT_FN_SOURCE_VAL
EXIT_FN_TARGET_VAL

Output

io_type

Returned as one of the following:

  • DDL type:

    SQL_DDL_VAL
    
  • DML types:

    DELETE_VAL
    INSERT_VAL
    UPDATE_VAL
    
  • Compressed SQL update:

    UPDATE_COMP_SQL_VAL
    UPDATE_COMP_PK_SQL_VAL
    
  • Other:

    TRUNCATE_TABLE_VAL
    

Return Values

EXIT_FN_RET_INVALID_CONTEXT
EXIT_FN_RET_INVALID_PARAM
EXIT_FN_RET_OK