8.8 COMPRESS_RECORD

Valid For

Extract and Replicat

Description

Use the COMPRESS_RECORD function to re-compress records that have been decompressed with the DECOMPRESS_RECORD function. Call COMPRESS_RECORD only after using DECOMPRESS_RECORD.

The content of the record buffer is not converted to or from the character set of the user exit. It is passed as-is.

Syntax

#include "usrdecs.h"
short result_code;
compressed_rec_def compressed_rec;
ERCALLBACK (COMPRESS_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

decompressed_rec

A pointer to the buffer containing the record before compression. The record is assumed to be in the default Oracle GoldenGate canonical format.

decompressed_len

The length of the decompressed record.

source_or_target

One of the following to indicate whether the source or target record is being compressed.

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.

columns_present

An array of values that indicates 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

Use the GET_TABLE_COLUMN_COUNT function to get the number of columns in the table (see "GET_TABLE_COLUMN_COUNT").

Output

compressed_rec

A pointer to the record returned in compressed format. Typically, compressed_rec is a pointer to a buffer of type exit_rec_buf_def. The exit_rec_buf_def buffer contains the actual record about to be processed by Extract or Replicat. The buffer is supplied when the call type is EXIT_CALL_DISCARD_RECORD. Exit routines may change the contents of this buffer, for example to perform custom mapping functions. The caller must ensure that the appropriate amount of memory is allocated to compressed_rec.

compressed_len

The returned length of the compressed record.

Return Values

EXIT_FN_RET_INVALID_CONTEXT
EXIT_FN_RET_OK
EXIT_FN_RET_INVALID_PARAM