# mco_backup_progress_info
RT

> Retrieve the current progress information of an ongoing backup operation.

### For an overview see page Incremental Online Backup in C

### Prototype

        MCO_RET mco_backup_progress_info(
            /*IN*/  mco_db_h connection,
            /*OUT*/ mco_backup_progress_info_t *pinfo
        );

### Arguments

`connection`
Valid database connection handle.
`pinfo`
Pointer to a `mco_backup_progress_info_t` structure that will be filled with current backup progress data. May be `NULL` if progress information is not needed.

### Description

> This function retrieves real-time progress information about an ongoing backup operation for the specified database. The data is copied from the internal `progress_info` field of the database's backup context (see `mco_database_backup_t`).

> The structure contains:

> - `phase` — current backup phase (`MCO_BACKUP_PROGRESS_IDLE`, `MCO_BACKUP_PROGRESS_LOOPING`, or `MCO_BACKUP_PROGRESS_FINALIZING`),
> - `max_passes` — maximum number of passes expected in the current backup cycle,
> - `max_steps` — total number of steps (e.g., pages to process) in the current pass,
> - `pass_no` — current pass number (1-based),
> - `step_no` — current step within the pass.

> If no backup operation is active, `phase` will be `MCO_BACKUP_PROGRESS_IDLE` and counters will be zero.

> Incremental backup must be enabled at database creation time via the `MCO_DB_INCREMENTAL_BACKUP_ENABLED` flag.

> See Incremental Backup and Restore for more details.

### Return Codes

`MCO_S_OK`
Progress information successfully retrieved (or `pinfo` is `NULL`).
`MCO_E_ILLEGAL_PARAM`
Invalid database connection handle.
`MCO_E_BACKUP_INVALID_PARAM`
Incremental backup support is not enabled in the database configuration (`MCO_DB_INCREMENTAL_BACKUP_ENABLED` flag was not set at database creation).

### Example

        {
            mco_db_h con;
            mco_backup_progress_info_t progress;
            MCO_RET rc;

            rc = mco_db_connect("mydb", &con);
            if (rc != MCO_S_OK) {
                /* handle connection error */
            }
            ...
            rc = mco_backup_progress_info(con, &progress);
            if (rc == MCO_S_OK && progress.phase != MCO_BACKUP_PROGRESS_IDLE) {
                printf("Backup phase: %u, Pass: %llu/%llu, Step: %llu/%llu\n",
                    (unsigned int)progress.phase,
                    (unsigned long long)progress.pass_no,
                    (unsigned long long)progress.max_passes,
                    (unsigned long long)progress.step_no,
                    (unsigned long long)progress.max_steps);
            }
        }

### Files

Header file:
mco.h
Source file:
mcoabst.c
Library:
libmcolib.a