1#ifndef ENGINE_SQLITE_H
2#define ENGINE_SQLITE_H
3#include <memory>
4
5struct sqlite3;
6struct sqlite3_stmt;
7class IConsole;
8class IStorage;
9
10class CSqliteDeleter
11{
12public:
13 void operator()(sqlite3 *pSqlite);
14};
15class CSqliteStmtDeleter
16{
17public:
18 void operator()(sqlite3_stmt *pStmt);
19};
20typedef std::unique_ptr<sqlite3, CSqliteDeleter> CSqlite;
21typedef std::unique_ptr<sqlite3_stmt, CSqliteStmtDeleter> CSqliteStmt;
22
23int SqliteHandleError(IConsole *pConsole, int Error, sqlite3 *pSqlite, const char *pContext);
24#define SQLITE_HANDLE_ERROR(x) SqliteHandleError(pConsole, x, &*pSqlite, #x)
25
26CSqlite SqliteOpen(IConsole *pConsole, IStorage *pStorage, const char *pPath);
27CSqliteStmt SqlitePrepare(IConsole *pConsole, sqlite3 *pSqlite, const char *pStatement);
28#endif // ENGINE_SQLITE_H
29