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

@@ -34,6 +34,7 @@
#include <cstdlib>
#include <memory>
#include "space/spaceparser.h"
#include "dbconnector.h"
#include "dbexpression.h"
#include "model.h"
@@ -427,6 +428,29 @@ void DbConnector::get_value(const char * value_str, PT::Date & field_value)
}
void DbConnector::get_value(const char * value_str, PT::Space & field_value)
{
field_value.Clear();
if( *value_str != '\0' )
{
PT::SpaceParser space_parser;
space_parser.SetSpace(field_value);
if( space_parser.ParseString(value_str) != PT::SpaceParser::ok )
{
field_value.Clear();
if( log )
{
(*log) << PT::Log::log1 << "Morm: I cannot correctly parse the Space struct from the datebase"
<< ", the raw string is: " << value_str << PT::Log::logend;
}
}
}
}
const char * DbConnector::query_last_sequence(const wchar_t * sequence_table_name)
{
return nullptr;