mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 09:46:02 -04:00
Fix compilation of new enum Database::BackupType for C++98
This commit is contained in:
parent
514d7d6846
commit
c1ab7075f4
@ -136,4 +136,5 @@ Version ?
|
||||
- #192 Add wrapper for bind parameter count
|
||||
- #197 Add tuple_bind and execute_many
|
||||
- #199 Fix #156 misleading error message in exception from Statement::exec
|
||||
- #201 Add Statement::getExpandedSQL() to get the SQL text of prepared statement with bound parameters expanded
|
||||
- #201 Add Statement::getExpandedSQL() to get the SQL text of prepared statement with bound parameters expanded
|
||||
- #211 Implement Database::backup()
|
||||
|
@ -434,6 +434,11 @@ public:
|
||||
*/
|
||||
static bool isUnencrypted(const std::string& aFilename);
|
||||
|
||||
/**
|
||||
* @brief BackupType for the backup() method
|
||||
*/
|
||||
enum BackupType { Save, Load };
|
||||
|
||||
/**
|
||||
* @brief Load or save the database content.
|
||||
*
|
||||
@ -443,7 +448,6 @@ public:
|
||||
*
|
||||
* @return SQLITE_OK on success or an error code from SQLite.
|
||||
*/
|
||||
enum class BackupType { Save, Load };
|
||||
int backup(const char* zFilename, BackupType type);
|
||||
|
||||
private:
|
||||
|
@ -314,8 +314,8 @@ int Database::backup(const char* zFilename, BackupType type) {
|
||||
** Otherwise, if this is a 'save' operation (isSave==1), then data
|
||||
** is copied from mpSQLite to pFile. Set the variables pFrom and
|
||||
** pTo accordingly. */
|
||||
sqlite3* pFrom = (type == BackupType::Save ? mpSQLite : pFile);
|
||||
sqlite3* pTo = (type == BackupType::Save ? pFile : mpSQLite);
|
||||
sqlite3* pFrom = (type == Save ? mpSQLite : pFile);
|
||||
sqlite3* pTo = (type == Save ? pFile : mpSQLite);
|
||||
|
||||
/* Set up the backup procedure to copy from the "main" database of
|
||||
** connection pFile to the main database of connection mpSQLite.
|
||||
|
@ -140,14 +140,14 @@ TEST(Database, import_export)
|
||||
|
||||
// Export the data into a file
|
||||
remove("backup");
|
||||
EXPECT_EQ(db.backup("backup", SQLite::Database::BackupType::Save), SQLITE_OK);
|
||||
EXPECT_EQ(db.backup("backup", SQLite::Database::Save), SQLITE_OK);
|
||||
|
||||
// Trash the table
|
||||
db.exec("DROP TABLE test;");
|
||||
EXPECT_FALSE(db.tableExists("test"));
|
||||
|
||||
// Import the data back from the file
|
||||
EXPECT_EQ(db.backup("backup", SQLite::Database::BackupType::Load), SQLITE_OK);
|
||||
EXPECT_EQ(db.backup("backup", SQLite::Database::Load), SQLITE_OK);
|
||||
|
||||
EXPECT_TRUE(db.tableExists("test"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user