add Finder::raw(pt::Date&,...) and esc(pt::Date &,...) methods

This commit is contained in:
Tomasz Sowa 2023-07-17 03:42:14 +02:00
parent 21f12a8a98
commit 8200092524
Signed by: tomasz.sowa
GPG Key ID: 662CC1438638588B
2 changed files with 37 additions and 0 deletions

View File

@ -231,6 +231,15 @@ public:
}
template<typename FieldValue>
void value_to_stream(pt::TextStream & stream, const FieldValue & field_value, const FT & field_type, ModelEnv * model_env = nullptr)
{
this->out_stream = &stream;
put_field_value(field_value, field_type, model_env);
this->out_stream = nullptr;
}
virtual void put_schema_table(const wchar_t * schema_name, const wchar_t * table_name);
virtual void put_schema_table(const pt::WTextStream & schema_name, const pt::WTextStream & table_name);
virtual void put_table(const wchar_t * table_name);

View File

@ -752,6 +752,17 @@ public:
}
Finder<ModelClass> & raw(const pt::Date & date, bool add_spaces = true, const FT & field_type = morm::FT::default_type)
{
if( out_stream && db_expression )
{
db_expression->esc(date, *out_stream, field_type);
}
return *this;
}
Finder<ModelClass> & esc(const char * str, bool add_quotes = true, const FT & field_type = morm::FT::default_type)
{
if( out_stream && db_expression )
@ -818,6 +829,23 @@ public:
}
Finder<ModelClass> & esc(const pt::Date & date, bool add_spaces = true, const FT & field_type = morm::FT::default_type)
{
if( out_stream && db_expression )
{
if( add_spaces )
(*out_stream) << ' ';
db_expression->value_to_stream(*out_stream, date, field_type);
if( add_spaces )
(*out_stream) << ' ';
}
return *this;
}
/*
* like
*/