Valid For
Extract and Replicat
Description
Use the DECOMPRESS_RECORD
function when you want to retrieve or manipulate an entire update record with the GET_RECORD_BUFFER
(see "GET_RECORD_BUFFER") or SET_RECORD_BUFFER
function (see "SET_RECORD_BUFFER") and the record is compressed. DECOMPRESS_RECORD
makes compressed records easier to process and map by putting the record into its logical column layout. The columns that are present will be in the expected positions without the index and length indicators (see "Compressed Record Format"). The missing columns will be represented as zeroes. When used, DECOMPRESS_RECORD
should be invoked before any manipulation occurs. After the user exit processing is completed, use the COMPRESS_RECORD
function (see "COMPRESS_RECORD") to re-compress the record before returning it to the Oracle GoldenGate process.
This function is valid for processing UPDATE
operations only. Deletes, inserts and updates appear in the buffer as full record images.
The content of the record buffer is not converted to or from the character set of the user exit. It is passed as-is.
Compressed Record Format
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.
Syntax
#include "usrdecs.h" short result_code; compressed_rec_def compressed_rec; ERCALLBACK (DECOMPRESS_RECORD, &compressed_rec, &result_code);
Buffer
typedef struct { char *compressed_rec; long compressed_len; char *decompressed_rec; long decompressed_len; short *columns_present; short source_or_target; char requesting_before_after_ind; } compressed_rec_def;
Input
compressed_rec
A pointer to the record in compressed format. Use the GET_RECORD_BUFFER
function to obtain this value (see "GET_RECORD_BUFFER").
compressed_len
The length of the compressed record. Use the GET_RECORD_BUFFER
(see "GET_RECORD_BUFFER") or GET_RECORD_LENGTH
(see "GET_RECORD_LENGTH") function to get this value.
source_or_target
One of the following to indicate whether the source or target record is being decompressed.
EXIT_FN_SOURCE_VAL EXIT_FN_TARGET_VAL
requesting_before_after_ind
Used as internal input. Does not need to be set. If set, it will be ignored.
Output
decompressed_rec
A pointer to the record returned in decompressed format. The record is assumed to be in the Oracle GoldenGate internal canonical format. The caller must ensure that the appropriate amount of memory is allocated to decompressed_rec
.
decompressed_len
The returned length of the decompressed record.
columns_present
An array of values that indicate the columns present in the compressed record. For example, if the first, third and sixth columns exist in the compressed record, and the total number of columns in the table is seven, the array should contain:
1, 0, 1, 0, 0, 1, 0
This array helps mapping functions determine when and whether a compressed column should be mapped.
Return Values
EXIT_FN_RET_INVALID_CONTEXT EXIT_FN_RET_OK EXIT_FN_RET_INVALID_PARAM