summaryrefslogtreecommitdiffhomepage
path: root/compiledsql.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiledsql.h')
-rw-r--r--compiledsql.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/compiledsql.h b/compiledsql.h
index 7510408..bb1062c 100644
--- a/compiledsql.h
+++ b/compiledsql.h
@@ -9,10 +9,8 @@
class CompiledSQL
{
public:
- CompiledSQL(SQLite::Database& db);
+ CompiledSQL(SQLite::Database& db, const std::string& stmt);
- void init(const std::string& stmt);
-
// index 1-based as in SQLite
template<typename T>
void bind(int index, T value)
@@ -29,8 +27,19 @@ public:
return m_stmt->getColumn(index);
}
+ class Guard
+ {
+ public:
+ Guard(CompiledSQL& cs);
+ ~Guard();
+ private:
+ CompiledSQL& m_cs;
+ };
+
private:
- std::shared_ptr<SQLite::Statement> m_stmt;
SQLite::Database& m_db;
+ std::string m_query;
+ std::shared_ptr<SQLite::Statement> m_stmt;
bool m_isSelect; // In SQLite, SELECT statements will be handled w/ executeStep(), others w/ exec()
};
+