░░░                                     ░░░
 ░░▒▒░░░░░░░░░               ░░░░░░░░░▒▒░░
  ░░▒▒▒▒▒░░░░░░░           ░░░░░░░▒▒▒▒▒░
      ░▒▒▒░░▒▒▒▒▒         ░░░░░░░▒▒░
            ░▒▒▒▒░       ░░░░░░
             ▒▒▒▒▒      ░░░░░░
              ▒▒▒▒▒     ░░░░░
              ░▒▒▒▒▒   ░░░░░
               ▒▒▒▒▒   ░░░░░
                ▒▒▒▒▒ ░░░░░
                ░▒▒▒▒▒░░░░░
                 ▒▒▒▒▒▒░░░
                  ▒▒▒▒▒▒░
  _____ _   _ _    _    _____       _
 / ____| \ | | |  | |  / ____|     (_)
| |  __|  \| | |  | | | |  __ _   _ ___  __
| | |_ | . ' | |  | | | | |_ | | | | \ \/ /
| |__| | |\  | |__| | | |__| | |_| | |>  <
 \_____|_| \_|\____/   \_____|\__,_|_/_/\_\
col); int64_t getInt(int col); }; Use use() { return Use(*this); } }; /* RAII helper that ensures transactions are aborted unless explicitly committed. */ struct SQLiteTxn { bool active = false; sqlite3 * db; SQLiteTxn(sqlite3 * db); void commit(); ~SQLiteTxn(); }; MakeError(SQLiteError, Error); MakeError(SQLiteBusy, SQLiteError); [[noreturn]] void throwSQLiteError(sqlite3 * db, const format & f); /* Convenience function for retrying a SQLite transaction when the database is busy. */ template<typename T> T retrySQLite(std::function<T()> fun) { while (true) { try { return fun(); } catch (SQLiteBusy & e) { } } } }