some test

This commit is contained in:
ineed bots 2023-09-10 15:26:29 -06:00
parent 84c212ed2b
commit 64f8dfca8d
2 changed files with 13 additions and 0 deletions

View File

@ -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")
}

View File

@ -10,6 +10,7 @@
#include <utils/http.hpp>
#include <json.hpp>
#include <parser.hpp>
#include <SQLiteCpp/Database.h>
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: