From 405b68b8246e992c03d3dbabdc46662a632c0cd8 Mon Sep 17 00:00:00 2001 From: TennesseeTrash Date: Mon, 9 Jun 2025 01:41:27 +0200 Subject: [PATCH] Import SQLite3 wrapper implementation from old repo --- CMake/sqlite3.cmake | 28 ++ Garbage/Include/Garbage/SQLite.hpp | 742 +++++++++++++++++++++++++++++ Tests/CMakeLists.txt | 1 + Tests/SQLite/CMakeLists.txt | 20 + Tests/SQLite/Main.cpp | 35 ++ 5 files changed, 826 insertions(+) create mode 100644 CMake/sqlite3.cmake create mode 100644 Garbage/Include/Garbage/SQLite.hpp create mode 100644 Tests/SQLite/CMakeLists.txt create mode 100644 Tests/SQLite/Main.cpp diff --git a/CMake/sqlite3.cmake b/CMake/sqlite3.cmake new file mode 100644 index 0000000..3e4a764 --- /dev/null +++ b/CMake/sqlite3.cmake @@ -0,0 +1,28 @@ +include(FetchContent) + +FetchContent_Declare( + sqlite3 + URL https://www.sqlite.org/2025/sqlite-amalgamation-3490100.zip + DOWNLOAD_EXTRACT_TIMESTAMP TRUE +) + +FetchContent_MakeAvailable( + sqlite3 +) + +add_library( + sqlite3 + STATIC +) + +target_include_directories( + sqlite3 + PUBLIC + ${sqlite3_SOURCE_DIR} +) + +target_sources( + sqlite3 + PRIVATE + ${sqlite3_SOURCE_DIR}/sqlite3.c +) diff --git a/Garbage/Include/Garbage/SQLite.hpp b/Garbage/Include/Garbage/SQLite.hpp new file mode 100644 index 0000000..21ea199 --- /dev/null +++ b/Garbage/Include/Garbage/SQLite.hpp @@ -0,0 +1,742 @@ +#ifndef GARBAGE_SQLITE_HPP +#define GARBAGE_SQLITE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace Garbage::SQLite +{ + ////////////////////////////////////////////////////////////////////////// + // TRAIT SUPPORT + + template + struct MemberTraits; + + template + struct MemberTraits + { + using Member = T; + using Container = U; + }; + + namespace Implementation + { + template + struct First; + + template + struct First + { + using Type = T; + }; + } + + template + using First = Implementation::First::Type; + + namespace Implementation + { + template