GET_RECORD_BUFFER
Valid For
Extract and Replicat
Description
Use the GET_RECORD_BUFFER
function to obtain information for custom column conversions. User exits can be used for data mapping between dissimilar source and target records when the COLMAP
option of the MAP
or TABLE
parameter is not sufficient. For example, you can use a user exit to convert a proprietary date field.
You can use the SET_RECORD_BUFFER
function (see "SET_RECORD_BUFFER") to modify the data retrieved with GET_RECORD_BUFFER
. However, it requires an understanding of the data record as written in the internal Oracle GoldenGate canonical format. As an alternative, you can set column values in the data record with the SET_COLUMN_VALUE_BY_INDEX
function (see "SET_COLUMN_VALUE_BY_INDEX") or the SET_COLUMN_VALUE_BY_NAME
function (see "@STRNCMP").
Deletes, inserts and updates appear in the buffer as full record images.
Compressed SQL updates have the following format:
index length value [index length value ][...]
where:
-
index
is a two-byte index into the list of columns of the table (first column is zero). -
length
is the two-byte length of the table. -
value
is the actual column value, including one of the following two-byte null indicators when applicable.0
is not null.-1
is null.
For SQL records, you can use the DECOMPRESS_RECORD
function ("DECOMPRESS_RECORD") to decompress the record for possible manipulation and then use the COMPRESS_RECORD
function ("COMPRESS_RECORD") to compress it again, as expected by the process.
Syntax
#include "usrdecs.h" short result_code; record_def record; ERCALLBACK (GET_RECORD_BUFFER, &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 record buffer for the source or target data record.
EXIT_FN_SOURCE_VAL EXIT_FN_TARGET_VAL
-
requesting_before_after_ind
-
Optional. Set when requesting a record buffer on a record io_type of
UPDATE_COMP_PK_SQL_VAL (
primary key update). Use one of the following to indicate which portion of the primary key update is to be accessed. The default isAFTER_IMAGE_VAL
.BEFORE_IMAGE_VAL AFTER_IMAGE_VAL
Output
-
buffer
-
A pointer to the record buffer. Typically, buffer is a pointer to a buffer of type
exit_rec_buf_def
. Theexit_rec_buf_def
buffer contains the actual record about to be processed by Extract or Replicat. The buffer is supplied when the call type isEXIT_CALL_DISCARD_RECORD
. Exit routines can change the contents of this buffer, for example, to perform custom mapping functions.The content of the record buffer is not converted to or from the character set of the user exit. It is passed as-is.
-
length
-
The returned length of the record buffer.
-
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
-
-
mapped
-
A flag (
0
or1
) indicating whether or not this is a mapped record buffer. -
before_after_ind
-
One of the following to indicate whether the record is a before or after image.
BEFORE_IMAGE_VAL AFTER_IMAGE_VAL
Return Values
EXIT_FN_RET_INVALID_CONTEXT EXIT_FN_RET_INVALID_PARAM EXIT_FN_RET_OK