fixed backend test compilation
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "matador/sql/column_definition.hpp"
|
||||
#include "matador/sql/condition.hpp"
|
||||
#include "matador/object/attribute_definition.hpp"
|
||||
|
||||
#include "matador/sql/connection.hpp"
|
||||
#include "matador/sql/query.hpp"
|
||||
#include "matador/sql/column_generator.hpp"
|
||||
|
||||
#include "matador/query/condition.hpp"
|
||||
#include "matador/query/query.hpp"
|
||||
|
||||
#include "matador/object/object_ptr.hpp"
|
||||
|
||||
@@ -12,6 +15,8 @@
|
||||
#include "models/airplane.hpp"
|
||||
|
||||
using namespace matador::sql;
|
||||
using namespace matador::object;
|
||||
using namespace matador::query;
|
||||
using namespace matador::test;
|
||||
|
||||
namespace matador::test::detail {
|
||||
@@ -35,29 +40,29 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<matador::object_ptr<airplane>> planes{
|
||||
std::vector<object_ptr<airplane>> planes{
|
||||
matador::test::detail::make_object_ptr<airplane>(1, "Airbus", "A380"),
|
||||
matador::test::detail::make_object_ptr<airplane>(2, "Boeing", "707"),
|
||||
matador::test::detail::make_object_ptr<airplane>(3, "Boeing", "747")
|
||||
};
|
||||
};
|
||||
|
||||
TEST_CASE_METHOD(StatementTestFixture, "Create prepared statement", "[statement]")
|
||||
{
|
||||
TEST_CASE_METHOD(StatementTestFixture, "Create prepared statement", "[statement]") {
|
||||
using namespace matador::utils;
|
||||
schema.attach<airplane>("airplane");
|
||||
REQUIRE(schema.attach<airplane>("airplane"));
|
||||
table ap{"airplane"};
|
||||
SECTION("Insert with prepared statement and placeholder") {
|
||||
auto stmt = query::insert()
|
||||
.into("airplane", column_generator::generate<airplane>(schema, true))
|
||||
.values<airplane>()
|
||||
.prepare(db);
|
||||
REQUIRE(stmt.is_ok());
|
||||
|
||||
for (const auto &plane: planes) {
|
||||
auto res = stmt.bind(*plane).execute();
|
||||
auto res = stmt->bind(*plane).execute();
|
||||
REQUIRE(res.is_ok());
|
||||
REQUIRE(*res == 1);
|
||||
stmt.reset();
|
||||
stmt->reset();
|
||||
}
|
||||
|
||||
auto result = query::select(column_generator::generate<airplane>(schema, true))
|
||||
@@ -87,8 +92,9 @@ TEST_CASE_METHOD(StatementTestFixture, "Create prepared statement", "[statement]
|
||||
.from(ap)
|
||||
.where("brand"_col == _)
|
||||
.prepare(db);
|
||||
REQUIRE(stmt.is_ok());
|
||||
|
||||
auto result = stmt.bind(0, "Airbus")
|
||||
auto result = stmt->bind(0, "Airbus")
|
||||
.fetch<airplane>();
|
||||
|
||||
REQUIRE(result.is_ok());
|
||||
@@ -98,9 +104,9 @@ TEST_CASE_METHOD(StatementTestFixture, "Create prepared statement", "[statement]
|
||||
REQUIRE(i.model == planes[0]->model);
|
||||
}
|
||||
|
||||
stmt.reset();
|
||||
stmt->reset();
|
||||
|
||||
result = stmt.bind(0, "Boeing")
|
||||
result = stmt->bind(0, "Boeing")
|
||||
.fetch<airplane>();
|
||||
|
||||
size_t index{1};
|
||||
|
||||
Reference in New Issue
Block a user