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