Add throw exception case in executeStep

Add Comments
This commit is contained in:
hongshibao
2015-10-26 00:35:36 +08:00
parent 05d304b7c9
commit c9dcf64cd0
2 changed files with 27 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
/**
* @file Backup.cpp
* @ingroup SQLiteCpp
* @brief Management of a SQLite Database Backup.
* @brief Backup is used to backup a database file in a safe and online way.
*
* Copyright (c) 2015 Shibao HONG (shibaohong@outlook.com)
*
@@ -74,9 +74,16 @@ Backup::~Backup() noexcept
}
}
int Backup::executeStep(const int aNumPage)
int Backup::executeStep(const int aNumPage /* = -1 */)
{
const int res = sqlite3_backup_step(mpSQLiteBackup, aNumPage);
if (SQLITE_OK != res && SQLITE_DONE != res &&
SQLITE_BUSY != res && SQLITE_LOCKED != res)
{
std::string strerr("Backup executeStep error with message ");
strerr += sqlite3_errstr(res);
throw SQLite::Exception(strerr);
}
return res;
}