backupCreate

Perform an incremental backup.

For an overview, see page Incremental Backup

Prototype

    void backupCreate(McoSql::String* file,
                      McoSql::String* label,
                      McoSql::BackupKind kind,
                      int compressionLevel,
                      McoSql::String* cipherKey);

Arguments

file
The path and filename for the backup file.
label
The label for this backup record.
kind
The type of backup.
compressionLevel
A backup compression level from 0 to 9 (0 = no compression; 1 indicates the fastest, but the lowest compression level).
cipherKey
A cipher to encrypt the backup.

Description

This method performs an incremental backup by calling the C API mco_backup_create(). (Please refer to the mco_backup_create() reference page for further details.)

Return Codes

Runtime Exception
In case of an error, a runtime exception will be thrown with the appropriate error message.

Example

    {
        MCO_RET rc;
        mco_device_t       dev[4];
        McoSqlEngine engine;
        McoSqlOpenParameters params;
        char * backup_file = "SimpleDb_backup.dbs";
        char label[MAX_LABEL_SIZE];
        int duration_msec = 1000;
        int msec;

        ...
        do
        {
            rc = engine.open(params);
            if ( MCO_S_OK == rc )
            {
                msec = (int)MCO_SYSTEM_GET_CURRENT_TIME_MSEC();
                sprintf(label, "Backup at %d msec", msec);

                /* backup the database */
                rc = engine.backupCreate( backup_file, label, Auto, 0, NULL);
                sleep_msec(duration_msec);
                engine.close();
            }
        } while (rc == MCO_S_OK && !stop);
        ...
    }