# mco_translog_apply

This function reads a specified log file up to the specified label and applies its content to the database.

### For an overview see page TL Applications

### Prototype

        MCO_RET	mco_translog_apply (	mco_db_h db,
                        char const *file_path,
                         int label_id )

### Arguments

db | Database connection handle
file_path | The path and filename or disk partition of the log file
label_id | The Id of a label or the value MCO_TRANSLOG_ALL_LABELS

### Description

This function reads a specified log file up to the specified label and, if the log file is “compatible”, applies its content to the database. To determine that the log file is compatible, first the dictionary, runtime and data sizes are checked, and then finally the database transaction counter is compared to the transaction counter stored in the log file. The log file compatibility can first be checked by calling the function `mco_translog_query_info()`.

Note that the `label_id` argument refers to labels inserted into the log by calls to `mco_translog_label()`. If labels are present in the log, by specifying the desired label number the log can be restored up to that label. While the constant `MCO_TRANSLOG_ALL_LABELS` means to read the complete log. (For example, it is possible to write labels once an hour and then restore and inspect the database state at a specified hour.)

### Return Codes

MCO_S_OK | The log file was read 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, if no end-of-file was found.
MCO_E_NOMEM | Insufficient memory to complete the operation.

### Files

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