19 typedef std::unique_ptr<sqlite3, void(*)(sqlite3*)>
SQLite3DB;
24 int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI,
25 std::string init = std::string()
43 const std::string& db_uri,
44 int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI
A database connection handler easying sharing the DB between C++ and Python.
sqlite3_stmt * prepare_statement(SQLite3DB &db, const std::string &query)
Prpare a statement.
void update_db_connection(SQLite3DB &old_db, const std::string &db_uri, int flags=SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_URI)
Force synchronization to disk by closing and opening the connection.
void validate_token(const std::string &token)
Ensure a token is alphanumeric.
SQLite3DB make_database(std::string filename, int flags=SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_URI, std::string init=std::string())
Initialize the database.
float read_as_float(sqlite3_stmt *, int)
Read a column field from a sqlite3 statement and convert it to float.
std::string dump_table(SQLite3DB &db, const std::string &query)
Dump the result of a query to a string.