aboutsummaryrefslogtreecommitdiff
path: root/src/sql/Sql.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/Sql.cpp')
-rw-r--r--src/sql/Sql.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sql/Sql.cpp b/src/sql/Sql.cpp
new file mode 100644
index 0000000..754a30d
--- /dev/null
+++ b/src/sql/Sql.cpp
@@ -0,0 +1,21 @@
+#include "../../include/odhtdb/sql/Sql.hpp"
+#include <sqlite3.h>
+
+namespace odhtdb
+{
+ int SqlArg::bind(sqlite3_stmt *stmt, int paramIndex) const
+ {
+ switch(type)
+ {
+ case Type::DATA_VIEW:
+ return sqlite3_bind_blob(stmt, paramIndex, dataView.data, dataView.size, SQLITE_STATIC);
+ case Type::INT:
+ return sqlite3_bind_int(stmt, paramIndex, integer);
+ case Type::INT64:
+ return sqlite3_bind_int64(stmt, paramIndex, integer64);
+ case Type::UINT64: // TODO: Find a way to use u64 in sqlite
+ return sqlite3_bind_int64(stmt, paramIndex, uinteger64);
+ }
+ return SQLITE_OK;
+ }
+}