SQLiteXX  0.1.0
 All Classes Namespaces Files Functions Enumerations Enumerator
Public Member Functions | List of all members
sqlite::backup Class Reference

Used to aid in the process of backing up a database. More...

#include <Backup.h>

Public Member Functions

 backup (const dbconnection &source, const dbconnection &destination, const std::string &sourceName="main", const std::string &destinationName="main")
 Construct a backup object. More...
 
bool step (const int pages=-1)
 Will copy a specified number of pages to the destination database. More...
 
int total_page_count () noexcept
 Returns the total number of pages in the source database. More...
 
int remaining_page_count () noexcept
 Returns the number of pages still to be backed up. More...
 
sqlite3_backup * handle () noexcept
 Returns the pointer to the underlying sqlite3_backup object.
 

Detailed Description

Used to aid in the process of backing up a database.

The backup object records state information about an ongoing online backup operation. It us useful either for creating backups of databases or for copying in-memory databases to or from persistent files.

Definition at line 20 of file Backup.h.

Constructor & Destructor Documentation

sqlite::backup::backup ( const dbconnection source,
const dbconnection destination,
const std::string &  sourceName = "main",
const std::string &  destinationName = "main" 
)

Construct a backup object.

Parameters
sourcethe database that will be the source of copied information
destinationthe database that will be backed up to
sourceNamethe source database name
destinationNamethe destination database name
Exceptions
sqlite::exceptionIf an error occurs when initializing a backup then an sqlite::exception will be raised.

Definition at line 14 of file Backup.cpp.

Member Function Documentation

int sqlite::backup::remaining_page_count ( )
noexcept

Returns the number of pages still to be backed up.

The values returned by this function is only updated by step(). If the source database is modified in a way that changes the size of the source database or the number of pages remaining, those changes are not reflected in the output of this method until after the next step().

Returns
The number of pages still to be backed up.

Definition at line 51 of file Backup.cpp.

bool sqlite::backup::step ( const int  pages = -1)

Will copy a specified number of pages to the destination database.

If pages is negative, all remaining source pages are copied.

pages the number of pages to copy from source to destination database.

Returns
The returns value will be true if there are more pages to copy. False otherwise.
Exceptions
sqlite::exceptionIf an error occurs when initializing a backup then an sqlite::exception will be raised.

Definition at line 34 of file Backup.cpp.

int sqlite::backup::total_page_count ( )
noexcept

Returns the total number of pages in the source database.

The values returned by this function is only updated by step(). If the source database is modified in a way that changes the size of the source database or the number of pages remaining, those changes are not reflected in the output of this method until after the next step().

Returns
The total number of pages in the source database.

Definition at line 46 of file Backup.cpp.


The documentation for this class was generated from the following files: