compilation fixes and disabled database type char[]

This commit is contained in:
Sascha Kühl 2025-11-21 09:11:14 +01:00
parent 3f3773dc71
commit d8903ed772
5 changed files with 13 additions and 13 deletions

View File

@ -246,7 +246,7 @@ utils::result<object::object_ptr<Type>, utils::error> session::update( const obj
using namespace matador::utils; using namespace matador::utils;
using namespace matador::query; using namespace matador::query;
const auto col = column(info.value().get().definition().primary_key()->name()); const auto col = column(info.value().get().reference_column()->name());
auto res = matador::query::query::update(info->get().name()) auto res = matador::query::query::update(info->get().name())
.set(generator::column_value_pairs<Type>()) .set(generator::column_value_pairs<Type>())
.where(col == _) .where(col == _)
@ -272,7 +272,7 @@ utils::result<void, utils::error> session::remove( const object::object_ptr<Type
using namespace matador::utils; using namespace matador::utils;
using namespace matador::query; using namespace matador::query;
const auto col = column(info.value().get().definition().primary_key()->name()); const auto col = column(info.value().get().reference_column()->name());
auto res = matador::query::query::remove() auto res = matador::query::query::remove()
.from( info->get().name() ) .from( info->get().name() )
.where(col == _) .where(col == _)
@ -294,7 +294,7 @@ utils::result<object::object_ptr<Type>, utils::error> session::find(const Primar
if (!info) { if (!info) {
return utils::failure(make_error(error_code::UnknownType, "Failed to determine requested type.")); return utils::failure(make_error(error_code::UnknownType, "Failed to determine requested type."));
} }
if (!info.value().get().definition().has_primary_key()) { if (!info.value().get().has_primary_key()) {
return utils::failure(make_error(error_code::NoPrimaryKey, "Type hasn't primary key.")); return utils::failure(make_error(error_code::NoPrimaryKey, "Type hasn't primary key."));
} }

View File

@ -13,10 +13,10 @@ class query_create_intermediate : public query_intermediate {
public: public:
query_create_intermediate(); query_create_intermediate();
executable_query table(const query::table &tab, std::initializer_list<object::attribute_definition> columns); executable_query table(const table &tab, std::initializer_list<object::attribute_definition> columns);
executable_query table(const query::table &tab, const std::vector<object::attribute_definition> &columns); executable_query table(const query::table &tab, const std::vector<object::attribute_definition> &columns);
template<class Type> template<class Type>
executable_query table(const query::table &tab, const object::repository &schema) { executable_query table(const matador::query::table &tab, const object::repository &schema) {
return this->table(tab, object::attribute_definition_generator::generate<Type>(schema)); return this->table(tab, object::attribute_definition_generator::generate<Type>(schema));
} }
executable_query schema(const std::string &schema_name); executable_query schema(const std::string &schema_name);

View File

@ -68,7 +68,7 @@ TEST_CASE_METHOD( QueryFixture, "Insert and select basic datatypes", "[query][da
ucval, usval, uival, ullval, ucval, usval, uival, ullval,
float_value, double_value, float_value, double_value,
bval, bval,
"Armer schwarzer Kater", // "Armer schwarzer Kater",
strval, varcharval, strval, varcharval,
// date_val, time_val, // date_val, time_val,
blob_val blob_val
@ -98,7 +98,7 @@ TEST_CASE_METHOD( QueryFixture, "Insert and select basic datatypes", "[query][da
REQUIRE((*result)->unsigned_long64_ == ullval); REQUIRE((*result)->unsigned_long64_ == ullval);
REQUIRE((*result)->float_ == float_value); REQUIRE((*result)->float_ == float_value);
REQUIRE((*result)->double_ == double_value); REQUIRE((*result)->double_ == double_value);
REQUIRE(strcmp((*result)->cstr_, cstr) == 0); // REQUIRE(strcmp((*result)->cstr_, cstr) == 0);
REQUIRE((*result)->bool_ == bval); REQUIRE((*result)->bool_ == bval);
REQUIRE((*result)->varchar_ == varcharval); REQUIRE((*result)->varchar_ == varcharval);
REQUIRE((*result)->string_ == strval); REQUIRE((*result)->string_ == strval);
@ -294,7 +294,7 @@ TEST_CASE_METHOD(QueryFixture, "Test describe table", "[query][describe][table]"
"val_char", "val_float", "val_double", "val_short", "val_char", "val_float", "val_double", "val_short",
"val_int", "val_long_long", "val_unsigned_char", "val_int", "val_long_long", "val_unsigned_char",
"val_unsigned_short", "val_unsigned_int", "val_unsigned_long_long", "val_unsigned_short", "val_unsigned_int", "val_unsigned_long_long",
"val_bool", "val_cstr", "val_string", "val_varchar", "val_bool", /*"val_cstr", */"val_string", "val_varchar",
// "val_date", "val_time", // "val_date", "val_time",
"val_binary"}; "val_binary"};
const std::vector<std::function<bool (const attribute_definition&)>> type_check = { const std::vector<std::function<bool (const attribute_definition&)>> type_check = {
@ -312,7 +312,7 @@ TEST_CASE_METHOD(QueryFixture, "Test describe table", "[query][describe][table]"
// [](const attribute_definition &cf) { return cf.is_integer(); }, // [](const attribute_definition &cf) { return cf.is_integer(); },
[](const attribute_definition &cf) { return cf.is_integer(); }, [](const attribute_definition &cf) { return cf.is_integer(); },
[](const attribute_definition &cf) { return cf.is_bool(); }, [](const attribute_definition &cf) { return cf.is_bool(); },
[](const attribute_definition &cf) { return cf.is_varchar(); }, // [](const attribute_definition &cf) { return cf.is_varchar(); },
[](const attribute_definition &cf) { return cf.is_string(); }, [](const attribute_definition &cf) { return cf.is_string(); },
[](const attribute_definition &cf) { return cf.is_varchar(); }, [](const attribute_definition &cf) { return cf.is_varchar(); },
// [](const attribute_definition &cf) { return cf.is_date(); }, // [](const attribute_definition &cf) { return cf.is_date(); },

View File

@ -21,7 +21,7 @@ using namespace matador::test;
TEST_CASE_METHOD(QueryFixture, "Test create statement", "[query][statement][create]") { TEST_CASE_METHOD(QueryFixture, "Test create statement", "[query][statement][create]") {
REQUIRE(repo.attach<matador::test::person>("person")); REQUIRE(repo.attach<matador::test::person>("person"));
auto stmt = query::create() auto stmt = query::create()
.table<person>("person"_tab, repo) .table<person>("person", repo)
.prepare(db); .prepare(db);
REQUIRE(stmt); REQUIRE(stmt);

View File

@ -8,7 +8,7 @@ namespace matador::test {
struct types struct types
{ {
enum { CSTR_LEN=255 }; // enum { CSTR_LEN=255 };
unsigned int id_ = 0; unsigned int id_ = 0;
int8_t char_ = 'c'; int8_t char_ = 'c';
@ -22,7 +22,7 @@ struct types
float float_ = 3.1415f; float float_ = 3.1415f;
double double_ = 1.1414; double double_ = 1.1414;
bool bool_ = true; bool bool_ = true;
char cstr_[CSTR_LEN]{}; // char cstr_[CSTR_LEN]{};
std::string string_ = "Welt"; std::string string_ = "Welt";
std::string varchar_ = "Erde"; std::string varchar_ = "Erde";
// matador::date date_; // matador::date date_;
@ -46,7 +46,7 @@ struct types
field::attribute(op, "val_unsigned_int", unsigned_int_); field::attribute(op, "val_unsigned_int", unsigned_int_);
field::attribute(op, "val_unsigned_long_long", unsigned_long64_); field::attribute(op, "val_unsigned_long_long", unsigned_long64_);
field::attribute(op, "val_bool", bool_); field::attribute(op, "val_bool", bool_);
field::attribute(op, "val_cstr", cstr_, CSTR_LEN); // field::attribute(op, "val_cstr", cstr_, CSTR_LEN);
field::attribute(op, "val_string", string_); field::attribute(op, "val_string", string_);
field::attribute(op, "val_varchar", varchar_, 63); field::attribute(op, "val_varchar", varchar_, 63);
// field::attribute(op, "val_date", date_); // field::attribute(op, "val_date", date_);