added noop_connection for testing
This commit is contained in:
@@ -2,13 +2,24 @@
|
||||
|
||||
#include <matador/sql/column_definition.hpp>
|
||||
#include <matador/sql/condition.hpp>
|
||||
#include <matador/sql/connection.hpp>
|
||||
#include <matador/sql/dialect_builder.hpp>
|
||||
#include <matador/sql/query_builder.hpp>
|
||||
#include <matador/sql/query.hpp>
|
||||
|
||||
using namespace matador::sql;
|
||||
using namespace matador::utils;
|
||||
|
||||
TEST_CASE("Create table sql statement string", "[query]") {
|
||||
connection noop("noop://noop.db");
|
||||
auto scm = std::make_shared<schema>("noop");
|
||||
query qu(noop, scm);
|
||||
auto s = qu.create().table({"person"}, {
|
||||
make_pk_column<unsigned long>("id"),
|
||||
make_column<std::string>("name", 255),
|
||||
make_column<unsigned short>("age")
|
||||
}).str();
|
||||
|
||||
dialect d = dialect_builder::builder().create().build();
|
||||
query_builder query(d);
|
||||
auto q = query.create().table("person", {
|
||||
@@ -17,7 +28,8 @@ TEST_CASE("Create table sql statement string", "[query]") {
|
||||
make_column<unsigned short>("age")
|
||||
}).compile();
|
||||
|
||||
REQUIRE(q.sql == R"##(CREATE TABLE "person" ("id" BIGINT NOT NULL, "name" VARCHAR(255) NOT NULL, "age" INTEGER NOT NULL, CONSTRAINT PK_person PRIMARY KEY (id)))##");
|
||||
REQUIRE(s == R"##(CREATE TABLE "person" ("id" BIGINT NOT NULL, "name" VARCHAR(255) NOT NULL, "age" INTEGER NOT NULL, CONSTRAINT PK_person PRIMARY KEY (id)))##");
|
||||
// REQUIRE(q.sql == R"##(CREATE TABLE "person" ("id" BIGINT NOT NULL, "name" VARCHAR(255) NOT NULL, "age" INTEGER NOT NULL, CONSTRAINT PK_person PRIMARY KEY (id)))##");
|
||||
REQUIRE(q.table_name == "person");
|
||||
|
||||
q = query.create().table("person", {
|
||||
|
||||
Reference in New Issue
Block a user