| 421 | } |
| 422 | |
| 423 | void Database::backup(const char* apFilename, BackupType aType) |
| 424 | { |
| 425 | // Open the database file identified by apFilename |
| 426 | Database otherDatabase(apFilename, SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE); |
| 427 | |
| 428 | // For a 'Save' operation, data is copied from the current Database to the other. A 'Load' is the reverse. |
| 429 | Database& src = (aType == BackupType::Save ? *this : otherDatabase); |
| 430 | Database& dest = (aType == BackupType::Save ? otherDatabase : *this); |
| 431 | |
| 432 | // Set up the backup procedure to copy between the "main" databases of each connection |
| 433 | Backup bkp(dest, src); |
| 434 | bkp.executeStep(); // Execute all steps at once |
| 435 | |
| 436 | // RAII Finish Backup an Close the other Database |
| 437 | } |
| 438 | |
| 439 | } // namespace SQLite |
nothing calls this directly
no test coverage detected