From 64f8dfca8d2378b316881ee3f6e0d3bc2382c65f Mon Sep 17 00:00:00 2001 From: ineed bots Date: Sun, 10 Sep 2023 15:26:29 -0600 Subject: [PATCH] some test --- deps/premake/SQLiteCpp.lua | 1 + src/component/test.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/deps/premake/SQLiteCpp.lua b/deps/premake/SQLiteCpp.lua index 059fb6a..4fd4d1a 100644 --- a/deps/premake/SQLiteCpp.lua +++ b/deps/premake/SQLiteCpp.lua @@ -22,6 +22,7 @@ function SQLiteCpp.project() files { path.join(path.join(SQLiteCpp.source, "src"), "**.cpp"), + path.join(path.join(SQLiteCpp.source, "include"), "**.h"), path.join(path.join(SQLiteCpp.source, "sqlite3"), "**.c"), path.join(path.join(SQLiteCpp.source, "sqlite3"), "**.h") } diff --git a/src/component/test.cpp b/src/component/test.cpp index 9cfb466..a789266 100644 --- a/src/component/test.cpp +++ b/src/component/test.cpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace test { @@ -46,6 +47,17 @@ namespace test printf("\n"); } } + + { + SQLite::Database db("test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); + db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT, weight INTEGER)"); + + db.exec("INSERT INTO test VALUES (NULL, \"first\", 3)"); + db.exec("INSERT INTO test VALUES (NULL, \"second\", 5)"); + db.exec("INSERT INTO test VALUES (NULL, \"third\", 7)"); + + printf("%s %s %d\n", db.execAndGet("SELECT value FROM test WHERE id=2").getString().c_str(), db.execAndGet("SELECT value FROM test WHERE weight=7").getString().c_str(), db.execAndGet("SELECT weight FROM test WHERE value=\"first\"").getInt()); + } } private: