7 void save(
const dbconnection& source,
const std::string& filename)
17 const std::string &sourceName,
18 const std::string &destinationName) :
22 destinationName.c_str(),
25 sqlite3_backup_finish),
26 m_destination(&destination)
30 throw_error_code(destination.
handle());
36 int const result = sqlite3_backup_step(m_handle.get(), pages);
38 if (result == SQLITE_OK)
return true;
39 if (result == SQLITE_DONE)
return false;
42 throw_error_code(m_destination->
handle());
48 return sqlite3_backup_pagecount(m_handle.get());
53 return sqlite3_backup_remaining(m_handle.get());
58 return m_handle.get();
sqlite3 * handle() const noexcept
Returns pointer to the underlying "sqlite3" object.
Used to aid in the process of backing up a database.
backup(const dbconnection &source, const dbconnection &destination, const std::string &sourceName="main", const std::string &destinationName="main")
Construct a backup object.
int remaining_page_count() noexcept
Returns the number of pages still to be backed up.
int total_page_count() noexcept
Returns the total number of pages in the source database.
bool step(const int pages=-1)
Will copy a specified number of pages to the destination database.
sqlite3_backup * handle() noexcept
Returns the pointer to the underlying sqlite3_backup object.
Class that represents a connection to a database.