Compare commits

..

No commits in common. "830185c3c58ef23243fd0ebf6f2e604e98d73620" and "c9a84e0568299981c6b320bd2190f1a5544fd9c5" have entirely different histories.

4 changed files with 11 additions and 32 deletions

View File

@ -12,7 +12,7 @@ list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
include(CTest)
include(Catch)
set(MYSQL_CONNECTION_STRING "mysql://test:test123!@127.0.0.1:3306/matador_test")
set(MYSQL_CONNECTION_STRING "mysql://test:test123!@127.0.0.1:3306/testdb")
configure_file(Connection.hpp.in ${PROJECT_BINARY_DIR}/backends/mysql/test/connection.hpp @ONLY IMMEDIATE)

View File

@ -245,9 +245,9 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and join_left"
auto result = db.query(schema).select({"f.id", "ap.brand", "ap.model", "f.pilot_name"})
.from({"flight", "f"})
.join_left({"airplane", "ap"})
.on("f.airplane_id"_col == "ap.id"_col)
.order_by("f.id").asc()
.fetch_all();
.on("f.airplane_id"_col == "ap.id"_col)
.order_by("f.id").asc()
.fetch_all();
std::vector<std::pair<unsigned long, std::string>> expected_result {
{4, "hans"},

View File

@ -53,8 +53,7 @@ TEST_CASE_METHOD(StatementTestFixture, "Create prepared statement", "[statement]
SECTION("Insert with prepared statement and placeholder") {
auto stmt = db.query(schema).insert()
.into<airplane>("airplane")
.values<airplane>()
.prepare();
.values<airplane>().prepare();
for (const auto &plane: planes) {
auto res = stmt.bind(*plane).execute();

View File

@ -88,19 +88,10 @@ TEST_CASE_METHOD(TypeTraitsTestFixture, "Special handling of attributes with typ
SECTION("Insert and select with direct execution") {
location loc{1, "center", {1, 2, 3}, Color::Black};
auto res = db
.query(schema)
.insert()
.into<location>("location")
.values(loc)
.execute();
auto res = db.query(schema).insert().into<location>("location").values(loc).execute();
REQUIRE(res == 1);
auto result = db
.query(schema)
.select<location>()
.from("location")
.fetch_all<location>();
auto result = db.query(schema).select<location>().from("location").fetch_all<location>();
for (const auto &l: result) {
REQUIRE(l.name == "center");
@ -110,23 +101,12 @@ TEST_CASE_METHOD(TypeTraitsTestFixture, "Special handling of attributes with typ
SECTION("Insert and select with prepared statement") {
location loc{1, "center", {1, 2, 3}, Color::Black};
auto stmt = db
.query(schema)
.insert()
.into<location>("location")
.values<location>()
.prepare();
auto res = stmt
.bind(loc)
.execute();
auto stmt = db.query(schema).insert().into<location>("location").values<location>().prepare();
auto res = stmt.bind(loc).execute();
REQUIRE(res == 1);
auto result = db
.query(schema)
.select<location>()
.from("location")
.fetch_all<location>();
auto result = db.query(schema).select<location>().from("location").
template fetch_all<location>();
for (const auto &l: result) {
REQUIRE(l.name == "center");