7#include <catch2/catch.hpp>
15 auto connection = Connection::Open(
":memory:", OpenMode::Memory);
17 REQUIRE(connection->CheckTableExists(
"test") ==
false);
18 REQUIRE(!!connection->Execute(
19 "CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);"));
20 REQUIRE(connection->CheckTableExists(
"test") ==
true);
21 REQUIRE(!!connection->Execute(
"INSERT INTO test (name) VALUES ('test1');"));
25 connection->CreateStatement(
"INSERT INTO test (name) VALUES (?);");
28 auto& ctx = stmt->Prepare();
30 auto run1 = ctx.Run();
32 REQUIRE(run1.HasRows() ==
false);
35 auto run2 = ctx.Run();
37 REQUIRE(run2.HasRows() ==
false);
41 auto stmt = connection->CreateStatement(
"SELECT * FROM test;");
44 auto run = stmt->Prepare().Run();
47 REQUIRE(run.HasRows() ==
true);
56 REQUIRE(row.Get(0,
id));
57 REQUIRE(row.Get(1,
name));
58 REQUIRE(!row.Get(2,
id));
61 REQUIRE(
name ==
"test" + std::to_string(rowId));
TEST_CASE("SQLiteHelpers", "")