summaryrefslogtreecommitdiffhomepage
path: root/compiledsql.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-29 13:19:33 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-29 13:19:33 +0100
commitf7160a063d5dedd9525b306534109b96087f1896 (patch)
treed53dea199a65aaf9ceac8aca75e060444087f963 /compiledsql.h
parent19c343fc2ea6dbf7eeae3ac7000c5c877ddfec63 (diff)
Add SQL VACUUM to cleanup
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()
};
+