ThinSQLite++
A thin, safe and convenient modern C++ wrapper for SQLite API.
Loading...
Searching...
No Matches
backup Class Referencefinal

Online backup object. More...

Inheritance diagram for backup:
handle< sqlite3_backup, backup >

Public Types

enum  step_result { done , success , busy , locked }
 Result of a backup step. More...
 

Public Member Functions

 ~backup () noexcept
 Equivalent to sqlite3_backup_finish.
 
step_result step (int page_count)
 Copy up to page_count pages between the source and destination databases.
 
int remaining () const noexcept
 Returns the number of pages still to be backed up after last step()
 
int pagecount () const noexcept
 Returns the total number of pages in the source database after last step()
 
void operator delete (void *) noexcept
 Operator delete for a fake pointer is no-op.
 
sqlite3_backupc_ptr () const noexcept
 Access the real underlying SQLite type.
 

Static Public Member Functions

static std::unique_ptr< backupinit (database &dst, const string_param &dest_dbname, database &src, const string_param &src_dbname)
 Initialize the backup.
 
static backupfrom (sqlite3_backup *obj) noexcept
 Create fake pointer from the underlying SQLite one.
 

Detailed Description

Online backup object.

This is a fake wrapper class for sqlite3_backup.

#include <thinsqlitepp/backup.hpp>

Member Enumeration Documentation

◆ step_result

Result of a backup step.

Enumerator
done 

Backup finished (SQLITE_DONE)

success 

Backup step succeeded (SQLITE_OK)

busy 

Database is busy, retry later (SQLITE_BUSY)

locked 

Source database is being written, retry later (SQLITE_LOCKED)

Member Function Documentation

◆ init()

static std::unique_ptr< backup > init ( database & dst,
const string_param & dest_dbname,
database & src,
const string_param & src_dbname )
inlinestatic

Initialize the backup.

Equivalent to sqlite3_backup_init

◆ step()

step_result step ( int page_count)
inline

Copy up to page_count pages between the source and destination databases.

Equivalent to sqlite3_backup_step

◆ remaining()

int remaining ( ) const
inlinenoexcept

Returns the number of pages still to be backed up after last step()

Equivalent to sqlite3_backup_remaining

◆ pagecount()

int pagecount ( ) const
inlinenoexcept

Returns the total number of pages in the source database after last step()

Equivalent to sqlite3_backup_pagecount