From 8200092524c46b9d85be66db242e2ff8bab43857 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Mon, 17 Jul 2023 03:42:14 +0200 Subject: [PATCH] add Finder::raw(pt::Date&,...) and esc(pt::Date &,...) methods --- src/baseexpression.h | 9 +++++++++ src/finder.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/baseexpression.h b/src/baseexpression.h index 24af73c..7d7ac35 100644 --- a/src/baseexpression.h +++ b/src/baseexpression.h @@ -231,6 +231,15 @@ public: } + template + 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); diff --git a/src/finder.h b/src/finder.h index 9c1cb46..c37f30c 100644 --- a/src/finder.h +++ b/src/finder.h @@ -752,6 +752,17 @@ public: } + Finder & 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 & 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 & 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 */