// Helper Class for SQLite backed storage #pragma once #include #include class CompiledSQL { public: CompiledSQL(SQLite::Database& db); void init(const std::string& stmt); // index 1-based as in SQLite template void bind(int index, T value) { m_stmt->bind(index, value); } bool execute(); // index 0-based as in SQLite template T getColumn(const int index) { return m_stmt->getColumn(index); } private: std::shared_ptr m_stmt; SQLite::Database& m_db; bool m_isSelect; // In SQLite, SELECT statements will be handled w/ executeStep(), others w/ exec() };