fixed query builder test
This commit is contained in:
parent
e74424aaaa
commit
f6aa100435
|
|
@ -2,8 +2,8 @@ CPMAddPackage("gh:catchorg/Catch2@3.7.1")
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
||||||
|
|
||||||
set(POSTGRES_CONNECTION_STRING "postgres://test:test123!@127.0.0.1:15442/matador")
|
#set(POSTGRES_CONNECTION_STRING "postgres://test:test123!@127.0.0.1:15442/matador")
|
||||||
#set(POSTGRES_CONNECTION_STRING "postgres://test:test123!@127.0.0.1:5432/matador")
|
set(POSTGRES_CONNECTION_STRING "postgres://test:test123!@127.0.0.1:5432/matador")
|
||||||
|
|
||||||
configure_file(Connection.hpp.in ${PROJECT_BINARY_DIR}/backends/postgres/test/connection.hpp @ONLY IMMEDIATE)
|
configure_file(Connection.hpp.in ${PROJECT_BINARY_DIR}/backends/postgres/test/connection.hpp @ONLY IMMEDIATE)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,9 @@ void query_compiler::visit(internal::query_add_foreign_key_constraint_part& part
|
||||||
query_.sql += ")";
|
query_.sql += ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
void query_compiler::visit(internal::query_add_primary_key_constraint_part& part) {}
|
void query_compiler::visit(internal::query_add_primary_key_constraint_part& part) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void query_compiler::visit(internal::query_add_foreign_key_reference_part& part) {
|
void query_compiler::visit(internal::query_add_foreign_key_reference_part& part) {
|
||||||
query_.sql += " " + dialect_->token_at(part.token()) + " " + part.table().name() + " (";
|
query_.sql += " " + dialect_->token_at(part.token()) + " " + part.table().name() + " (";
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ TEST_CASE_METHOD(QueryFixture, "Test create table sql statement string", "[query
|
||||||
})
|
})
|
||||||
.compile(*db);
|
.compile(*db);
|
||||||
|
|
||||||
REQUIRE(ctx.sql == R"##(CREATE TABLE "person" ("id" BIGINT NOT NULL, "name" VARCHAR(255) NOT NULL UNIQUE, "age" INTEGER NOT NULL, "address" BIGINT NOT NULL, CONSTRAINT PK_person PRIMARY KEY (id), CONSTRAINT FK_person_address FOREIGN KEY (address)))##");
|
REQUIRE(ctx.sql == R"##(CREATE TABLE "person" ("id" BIGINT NOT NULL, "name" VARCHAR(255) NOT NULL UNIQUE, "age" INTEGER NOT NULL, "address" BIGINT NOT NULL, CONSTRAINT PK_person PRIMARY KEY (id), CONSTRAINT FK_person_address FOREIGN KEY (address) REFERENCES address (id)))##");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_METHOD(QueryFixture, "Test drop table sql statement string", "[query]") {
|
TEST_CASE_METHOD(QueryFixture, "Test drop table sql statement string", "[query]") {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue