mco_translog_query_info

This function reads a specified log file to check it for compatibility with the current database and to enumerate its labels.

For an overview see page TL Applications

Prototype

 
    MCO_RET	mco_translog_query_info (	mco_db_h db, 
                        char const *file_path, 
                        mco_TL_labels_proc labels_proc, 
                        void * user_data, 
                        mco_TL_log_info_h info )
 

Arguments

db Database connection handle
file_path The path and filename or disk partition of the log file.
labels_proc A user defined call-back function that enumerates labels inside the log file. (Note: May be NULL if is not used).
user_data A pointer to user-specified data that will be passed to the call-back function labels_proc.
info A pointer to a structure defined as:
 
typedef struct mco_TL_log_info_
{
    mco_trans_counter_t start_trans_counter;
    mco_trans_counter_t stop_trans_counter;
    mco_trans_counter_t stored_transactions;
    uint2               disk_page_size;
    uint2               page_size;
    mco_size_t          log_size;
    int                 labels_count;
    mco_bool            crc;
    mco_bool            aligned;
    mco_bool            dictionary_compat;
    mco_bool     transaction_apply_compat;
    mco_bool     transaction_append_compat;
    mco_bool            not_corrupted;
    mco_bool            iteratable;
} mco_TL_log_info_t,*mco_TL_log_info_h;
 

Note: May be NULL if is not used (i.e. is used only to enumerate the labels). (The structure elements are explained below.)

Description

This function reads a specified log file to check it for compatibility with the current database and to enumerate its labels.

Return Codes

MCO_S_OK The TL runtime was initialized successfully.
MCO_E_TL_LOG_NOT_OPENED The log file could not be opened.
MCO_E_TL_IO_ERROR Disk IO error.
MCO_E_VERS_MISMATCH The log file is incompatible with the runtime settings or the database version.
MCO_E_TL_INVFORMAT The log file is corrupted.
MCO_S_TL_INVDATA The log file was not read completely but some transactions were found or no end-of-file was found. In the latter case info.transaction_apply_compat will be MCO_YES, info.not_corrupted will be MCO_NO and info.transaction_append_compat will be MCO_NO.

The structure elements for structure mco_TL_log_info are defined as follows:

start_trans_counter The value of the transaction counter when the log file was started.
last_trans_counter The value of the transaction counter when the log file was finished.
stored_transactions The count of transactions stored in the log file.
disk_page_size Size of a single disk page.
page_size Size of an in-memory database page.
log_size The total size of the log file, in bytes.
labels_count The count of labels stored in the log file.
crc MCO_YES if the log was created with MCO_TRANSLOG_CRC flag; otherwise MCO_NO.
aligned MCO_YES if the log was created with MCO_TRANSLOG_ALIGNED flag; otherwise MCO_NO.
dictionary_compat MCO_YES if the log file is compatible with the database specified by the argument "db"; otherwise MCO_NO.
transaction_apply_compat MCO_YES if the log file is compatible for applying to the database specified by argument "db" (by transaction number); otherwise MCO_NO.
transaction_append_compat MCO_YES if the log file is compatible for appending to the database specified by argument "db" (by transaction number); otherwise MCO_NO.
not_corrupted MCO_YES if no data has been lost since the last save-point.
iteratable MCO_YES if the log file was written with the MCO_TRANSLOG_ITERABLE flag.

The user-defined callback procedure labels_proc must have the following prototype:

 
    typedef void(*mco_TL_labels_proc)(const char *label, int label_id, void *data);
     

where label is the label text, label_id is the integer value associated with this label (that was generated by the TL runtime when the function mco_translog_label() was called), and data is a pointer to application-specific data that may be used in the implementation of the label procedure.

Files

Header file:
mcolog.h
Source file:
mcolog.c
Library:
libmcolog.a