8.22 GET_DDL_RECORD_PROPERTIES

Valid For

Extract and Replicat, for databases for which DDL replication is supported

Description

Use the GET_DDL_RECORD_PROPERTIES function to return a DDL operation, including information about the object on which the DDL was performed and also the text of the DDL statement itself. The Extract process can only get the source table layout. The Replicat process can get source or target layouts.

If the character session of the user exit is set with SET_SESSION_CHARSET to a value other than the default character set of the operating system, as defined in ULIB_CS_DEFAULT in the ucharset.h file, the character data that is exchanged between the user exit and the process is interpreted in the session character set. This includes the DDL type, the object type, the two- or three-part object name, the owner name and the DDL text itself.

#include "usrdecs.h"
short result_code;
ddl_record_def ddl_rec;
ERCALLBACK (GET_DDL_RECORD_PROPERTIES, &ddl_rec, &result_code);

Buffer

typedef struct
{
char *ddl_type;
long ddl_type_max_length; /* Maximum Description length PASSED IN BY USER */
long ddl_type_length; /* Actual length */

char *object_type; 
long object_type_max_length; /* Maximum Description length PASSED IN BY USER */
long object_type_length; /* Actual length */

char *object_name; /* Fully qualified name of the object
  (3-part for CDB, 2-part for non-CDB) */
long object_max_length; /* Maximum Description length PASSED IN BY USER */
long object_length; /* Actual length */

char *owner_name;
long owner_max_length; /* Maximum Description length PASSED IN BY USER */
long owner_length; /* Actual length */

char *ddl_text;
long ddl_text_max_length; /* Maximum Description length PASSED IN BY USER */
long ddl_text_length; /* Actual length */

short ddl_text_truncated; /* Was value truncated? */
short source_or_target; /* Source or target value? */
} ddl_record_def;

Input

ddl_type_length
object_type_length
object_length
owner_length
ddl_text_length

A pointer to one buffer for each of these items to accept the returned column values. These items are as follows:

ddl_type_length

Contains the length of the type of DDL operation, for example a CREATE or ALTER.

object_type_length

Contains the length of type of database object that is affected by the DDL operation, for example TABLE or INDEX.

object_length

Contains the length of the name of the object.

object_length

Contains the length of the owner of the object (schema or database).

ddl_text_length

Contains the length of the actual DDL statement text.

ddl_type_max_length

The maximum length of the DDL operation type that is returned by *ddl_type. The DDL type is any DDL command that is valid for the database, such as ALTER.

object_type_max_length

The maximum length of the object type that is returned by *object_type. The object type is any object that is valid for the database, such as TABLE, INDEX, and TRIGGER.

object_max_length

The maximum length of the name of the object that is returned by *object_name.

owner_max_length

The maximum length of the name of the owner that is returned by *owner_name.

ddl_text_max_length

The maximum length of the text of the DDL statement that is returned by *ddl_text.

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

ddl_type_length
object_type_length
object_length
owner_length
ddl_text_length

All of these fields return the actual length of the value that was requested. (See the input for descriptions.)

ddl_text_truncated

A flag (0 or 1) to indicate whether or not the DDL text was truncated. Truncation occurs if the length of the DDL text plus the null terminator exceeds the maximum buffer length.

Return Values

EXIT_FN_RET_OK
EXIT_FN_RET_NOT_SUPPORTED
EXIT_FN_RET_INVALID_CONTEXT
EXIT_FN_RET_INCOMPLETE_DDL_REC