added support for PT::Space as a field in a Model

methods before_field_value_string() and after_field_value_string() moved
from DbExpression and JsonExpression to BaseExpression and made virtual
and now methods before_field_value(const std::wstring &) and after_field_value(const std::wstring &)
(and the rest of them with string arguments) can be removed from DbExpression, PostgreSqlExpression and JsonExpression
This commit is contained in:
2021-03-11 18:40:32 +01:00
parent f7490594ad
commit 7bef1d5ead
14 changed files with 246 additions and 318 deletions

View File

@@ -42,6 +42,7 @@
#include <type_traits>
#include "textstream/textstream.h"
#include "space/space.h"
#include "modelconnector.h"
#include "dbexpression.h"
#include "flatexpression.h"
@@ -306,6 +307,11 @@ protected:
field_generic(field_name, field_name, field_value, field_type);
}
void field(const wchar_t * field_name, PT::Space & field_value, FT field_type = FT::default_type)
{
field_generic(field_name, field_name, field_value, field_type);
}
void field(const wchar_t * field_name, Model & field_value, FT field_type = FT::default_type)
{
// has_foreign_key was here
@@ -416,6 +422,10 @@ protected:
field_generic(db_field_name, flat_field_name, field_value, field_type);
}
void field(const wchar_t * db_field_name, const wchar_t * flat_field_name, PT::Space & field_value, FT field_type = FT::default_type)
{
field_generic(db_field_name, flat_field_name, field_value, field_type);
}
void field(const wchar_t * db_field_name, const wchar_t * flat_field_name, Model & field_value, FT field_type = FT::default_type)
{
@@ -480,6 +490,7 @@ protected:
}
}
template<typename FieldValue>
void field_generic_iterate_primary_key_values(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value, FT field_type)
{
@@ -499,6 +510,7 @@ protected:
}
}
template<typename FieldValue>
void field_generic_generate_flat_string(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value, FT field_type)
{
@@ -515,6 +527,7 @@ protected:
}
}
template<typename FieldValue>
void field_generic_generate_db_sql(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value, FT field_type)
{
@@ -531,6 +544,7 @@ protected:
}
}
template<typename FieldValue>
void field_generic_read_value_from_db_resultset(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value, FT field_type)
{
@@ -553,6 +567,7 @@ protected:
}
}
template<typename FieldValue>
void field_generic_clear_value(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value, FT field_type)
{
@@ -1371,6 +1386,8 @@ protected:
};
} // namespace
#endif