query builder progress

This commit is contained in:
Sascha Kühl
2025-12-02 16:19:13 +01:00
parent c156ab5e74
commit bfbbd4c589
31 changed files with 348 additions and 164 deletions
+17 -19
View File
@@ -9,9 +9,7 @@ TEST_CASE("Test create empty column", "[column]") {
attribute c("name");
REQUIRE(c.name() == "name");
REQUIRE(c.index() == -1);
REQUIRE(c.type() == basic_type::type_null);
REQUIRE(!c.reference_column());
c.change_type<std::string>(255);
REQUIRE(c.type() == basic_type::type_varchar);
@@ -24,39 +22,39 @@ TEST_CASE("Test copy and move column", "[column]") {
attribute c(
"name",
basic_type::type_varchar,
2,
std::make_shared<attribute>("author", basic_type::type_uint32, "books", attribute_options{constraints::ForeignKey}),
// 2,
// std::make_shared<attribute>("author", basic_type::type_uint32, "books", attribute_options{constraints::ForeignKey}),
{255, constraints::ForeignKey},
null_option_type::NOT_NULL
null_option_type::NotNull
);
REQUIRE(c.name() == "name");
REQUIRE(c.index() == 2);
REQUIRE(c.reference_column());
REQUIRE(c.reference_column()->name() == "author");
REQUIRE(c.reference_column()->table_name() == "books");
// REQUIRE(c.index() == 2);
// REQUIRE(c.reference_column());
// REQUIRE(c.reference_column()->name() == "author");
// REQUIRE(c.reference_column()->table_name() == "books");
REQUIRE(c.type() == basic_type::type_varchar);
REQUIRE(c.attributes().size() == 255);
auto c2 = c;
REQUIRE(c2.name() == "name");
REQUIRE(c2.index() == 2);
REQUIRE(c2.reference_column());
REQUIRE(c2.reference_column()->name() == "author");
REQUIRE(c2.reference_column()->table_name() == "books");
// REQUIRE(c2.index() == 2);
// REQUIRE(c2.reference_column());
// REQUIRE(c2.reference_column()->name() == "author");
// REQUIRE(c2.reference_column()->table_name() == "books");
REQUIRE(c2.type() == basic_type::type_varchar);
REQUIRE(c2.attributes().size() == 255);
auto c3 = std::move(c2);
REQUIRE(c3.name() == "name");
REQUIRE(c3.index() == 2);
REQUIRE(c3.reference_column());
REQUIRE(c3.reference_column()->name() == "author");
REQUIRE(c3.reference_column()->table_name() == "books");
// REQUIRE(c3.index() == 2);
// REQUIRE(c3.reference_column());
// REQUIRE(c3.reference_column()->name() == "author");
// REQUIRE(c3.reference_column()->table_name() == "books");
REQUIRE(c3.type() == basic_type::type_varchar);
REQUIRE(c3.attributes().size() == 255);
REQUIRE(c2.name().empty());
REQUIRE(c2.index() == 2);
REQUIRE(!c2.reference_column());
// REQUIRE(c2.index() == 2);
// REQUIRE(!c2.reference_column());
REQUIRE(c2.attributes().size() == 255);
}