summaryrefslogtreecommitdiff
path: root/modules/codec-sql/c++
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2025-08-29 22:17:14 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2025-08-29 22:17:27 +0200
commit6379fe9ca2cad3d0c9d886e7808b1d579ce349c2 (patch)
treef0b86c5c64476ace6a02bca6586047df0dae4196 /modules/codec-sql/c++
parent153f808a0eb648a28a2203a96a5d68f9245e361b (diff)
Not even sure why I have this
Diffstat (limited to 'modules/codec-sql/c++')
-rw-r--r--modules/codec-sql/c++/SConscript38
-rw-r--r--modules/codec-sql/c++/sql.hpp35
2 files changed, 73 insertions, 0 deletions
diff --git a/modules/codec-sql/c++/SConscript b/modules/codec-sql/c++/SConscript
new file mode 100644
index 0000000..b31529d
--- /dev/null
+++ b/modules/codec-sql/c++/SConscript
@@ -0,0 +1,38 @@
+#!/bin/false
+
+import os
+import os.path
+import glob
+
+
+Import('env')
+
+dir_path = Dir('.').abspath
+
+# Environment for base library
+codec_sql_env = env.Clone();
+
+codec_sql_env.sources = sorted(glob.glob(dir_path + "/*.cpp"))
+codec_sql_env.headers = sorted(glob.glob(dir_path + "/*.hpp"))
+
+env.sources += codec_sql_env.sources;
+env.headers += codec_sql_env.headers;
+
+## Shared lib
+objects_shared = []
+codec_sql_env.add_source_files(objects_shared, codec_sql_env.sources, shared=True);
+env.library_shared = codec_sql_env.SharedLibrary('#build/forstio-codec-sql', [objects_shared]);
+
+## Static lib
+objects_static = []
+codec_sql_env.add_source_files(objects_static, codec_sql_env.sources, shared=False);
+env.library_static = codec_sql_env.StaticLibrary('#build/forstio-codec-sql', [objects_static]);
+
+# Set Alias
+env.Alias('library_codec_sql', [env.library_shared, env.library_static]);
+
+env.targets += ['library_codec_sql'];
+
+# Install
+env.Install('$prefix/lib/', [env.library_shared, env.library_static]);
+env.Install('$prefix/include/forstio/codec/sql/', [codec_sql_env.headers]);
diff --git a/modules/codec-sql/c++/sql.hpp b/modules/codec-sql/c++/sql.hpp
new file mode 100644
index 0000000..5f4f3d3
--- /dev/null
+++ b/modules/codec-sql/c++/sql.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <forstio/codec/data.hpp>
+#include <sqlite3.h>
+
+namespace saw {
+namespace encode {
+struct Sql {};
+}
+}
+
+namespace saw{
+template<typename Schema>
+class data<Schema, encode::Sql> {
+private:
+ data<Schema> int_;
+public:
+ data(const data<Schema>& int__):int_{int__}{}
+ data(data<Schema>&& int__):int_{std::move(int__)}{}
+};
+
+template<typename Schema>
+class codec<Schema, encode::Sql> {
+private:
+ template<typename ToEncode>
+ error_or<void> decode(data<Schema,encode::Sql>& from, data<Schema, ToEncode>& to){
+ return make_error<err::not_implemented>("SQL decode not available");
+ }
+
+ template<typename FromEncode>
+ error_or<void> encode(data<Schema,FromEncode>& from, data<Schema, encode::Sql>& to){
+ return make_error<err::not_implemented>("SQL encode not available");
+ }
+};
+}