1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 09:31:16 +02:00

SQLite:: Add some convenience

This commit is contained in:
Eelco Dolstra 2016-08-09 14:27:30 +02:00
parent 6cb4bdf152
commit f294623d1d
4 changed files with 33 additions and 28 deletions

View file

@ -13,10 +13,16 @@ namespace nix {
/* RAII wrapper to close a SQLite database automatically. */
struct SQLite
{
sqlite3 * db;
SQLite() { db = 0; }
sqlite3 * db = 0;
SQLite() { }
SQLite(const Path & path);
SQLite(const SQLite & from) = delete;
SQLite& operator = (const SQLite & from) = delete;
SQLite& operator = (SQLite && from) { db = from.db; from.db = 0; return *this; }
~SQLite();
operator sqlite3 * () { return db; }
void exec(const std::string & stmt);
};
/* RAII wrapper to create and destroy SQLite prepared statements. */