summaryrefslogtreecommitdiff
path: root/include/db/statement.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/db/statement.h')
-rw-r--r--include/db/statement.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/db/statement.h b/include/db/statement.h
new file mode 100644
index 0000000..8c2ade2
--- /dev/null
+++ b/include/db/statement.h
@@ -0,0 +1,43 @@
+/*
+ * statement.h
+ *
+ * Created on: 28.10.2012
+ * Author: savop
+ */
+
+#ifndef STATEMENT_H_
+#define STATEMENT_H_
+
+#include <sqlite3.h>
+
+namespace db {
+
+class Statement {
+private:
+
+ boost::shared_ptr<sqlite3_stmt> m_statement;
+ boost::shared_ptr<sqlite3> m_connection;
+
+public:
+
+ Statement() {}
+
+ Statement(boost::shared_ptr<sqlite3>& conn, boost::shared_ptr<sqlite3_stmt>& stmt)
+ : m_connection(conn)
+ , m_statement(stmt)
+ {}
+
+ virtual ~Statement(){}
+
+ Statement& execute(){
+ if(sqlite3_step(m_statement.get()) != SQLITE_OK)
+ throw SQLiteException(sqlite3_errmsg(m_connection.get()));
+
+ return *this;
+ }
+
+};
+
+} // namespace db
+
+#endif /* STATEMENT_H_ */