MCPcopy Create free account
hub / github.com/bcndev/bytecoin / backup_db

Method backup_db

src/platform/DBsqlite3.cpp:282–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280 std::remove((ep + ".sqlite-journal").c_str());
281}
282void DBsqliteKV::backup_db(const std::string &path, const std::string &dst_path) {
283 throw platform::sqlite::Error("SQlite backed does not support hot backup - stop daemons, then copy database");
284 /* bool src_created = false;
285 sqlite::Dbi src;
286 src.open_check_create(platform::O_READ_EXISTING, path + ".sqlite", &src_created);
287
288 bool dst_created = false;
289 sqlite::Dbi dst;
290 dst.open_check_create(platform::O_CREATE_NEW, dst_path + ".sqlite", &dst_created);
291
292 auto ba = sqlite3_backup_init(dst.handle, "main", src.handle, "main");
293 if(!ba)
294 throw platform::sqlite::Error("SQlite failed to start hot backup - stop daemons, then copy database");
295 // while(true){
296 auto res = sqlite3_backup_step(ba, -1);
297 sqlite3_backup_finish(ba); ba = nullptr;
298 if(res != SQLITE_DONE)
299 sqlite::check(res, "sqlite3_backup_step failed");
300 // std::cout << "." << std::flush;
301 // }
302 */
303}
304
305void DBsqliteKV::run_tests() {
306 delete_db("temp_db");

Callers

nothing calls this directly

Calls 1

ErrorClass · 0.70

Tested by

no test coverage detected