From 7bef1d5ead5a8d15baf5b8af52ee02a5814f59ac Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 11 Mar 2021 18:40:32 +0100 Subject: [PATCH] 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 --- src/Makefile.dep | 16 +-- src/baseexpression.cpp | 229 +++++++++++++++++++++-------------- src/baseexpression.h | 77 +++++++----- src/clearer.cpp | 7 +- src/clearer.h | 4 +- src/dbconnector.cpp | 24 ++++ src/dbconnector.h | 3 +- src/dbexpression.cpp | 68 +---------- src/dbexpression.h | 15 --- src/jsonexpression.cpp | 32 ----- src/jsonexpression.h | 7 -- src/model.h | 17 +++ src/postgresqlexpression.cpp | 54 +-------- src/postgresqlexpression.h | 11 -- 14 files changed, 246 insertions(+), 318 deletions(-) diff --git a/src/Makefile.dep b/src/Makefile.dep index e0eb565..2a1bf2a 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep @@ -13,18 +13,20 @@ baseexpression.o: finderhelper.h fieldvaluehelper.h ft.h model.h baseexpression.o: modelconnector.h clearer.h dbconnector.h flatconnector.h baseexpression.o: dbexpression.h flatexpression.h ../../pikotools/utf8/utf8.h clearer.o: clearer.h ../../pikotools/date/date.h -clearer.o: ../../pikotools/convert/inttostr.h model.h +clearer.o: ../../pikotools/convert/inttostr.h ../../pikotools/space/space.h +clearer.o: ../../pikotools/textstream/types.h model.h clearer.o: ../../pikotools/textstream/textstream.h -clearer.o: ../../pikotools/space/space.h ../../pikotools/textstream/types.h clearer.o: ../../pikotools/membuffer/membuffer.h clearer.o: ../../pikotools/textstream/types.h modelconnector.h dbconnector.h clearer.o: ../../pikotools/log/log.h ../../pikotools/log/filelog.h clearer.o: queryresult.h flatconnector.h dbexpression.h baseexpression.h clearer.o: morm_types.h modelenv.h modeldata.h cursorhelper.h finderhelper.h clearer.o: fieldvaluehelper.h ft.h flatexpression.h -dbconnector.o: dbconnector.h ../../pikotools/textstream/textstream.h +dbconnector.o: ../../pikotools/space/spaceparser.h dbconnector.o: ../../pikotools/space/space.h -dbconnector.o: ../../pikotools/textstream/types.h ../../pikotools/date/date.h +dbconnector.o: ../../pikotools/textstream/types.h dbconnector.h +dbconnector.o: ../../pikotools/textstream/textstream.h +dbconnector.o: ../../pikotools/space/space.h ../../pikotools/date/date.h dbconnector.o: ../../pikotools/convert/inttostr.h dbconnector.o: ../../pikotools/membuffer/membuffer.h dbconnector.o: ../../pikotools/textstream/types.h ../../pikotools/log/log.h @@ -105,10 +107,10 @@ model.o: dbexpression.h baseexpression.h morm_types.h modelenv.h modeldata.h model.o: cursorhelper.h finderhelper.h fieldvaluehelper.h ft.h model.o: flatexpression.h modelconnector.o: modelconnector.h clearer.h ../../pikotools/date/date.h -modelconnector.o: ../../pikotools/convert/inttostr.h dbconnector.h -modelconnector.o: ../../pikotools/textstream/textstream.h +modelconnector.o: ../../pikotools/convert/inttostr.h modelconnector.o: ../../pikotools/space/space.h -modelconnector.o: ../../pikotools/textstream/types.h +modelconnector.o: ../../pikotools/textstream/types.h dbconnector.h +modelconnector.o: ../../pikotools/textstream/textstream.h modelconnector.o: ../../pikotools/membuffer/membuffer.h modelconnector.o: ../../pikotools/textstream/types.h modelconnector.o: ../../pikotools/log/log.h ../../pikotools/log/filelog.h diff --git a/src/baseexpression.cpp b/src/baseexpression.cpp index 96f6248..be1f0a3 100644 --- a/src/baseexpression.cpp +++ b/src/baseexpression.cpp @@ -313,51 +313,70 @@ void BaseExpression::after_second_part_long_field_name() void BaseExpression::before_field_value(const std::wstring &) { + before_field_value_string(); } void BaseExpression::before_field_value(const std::string &) { + before_field_value_string(); } void BaseExpression::after_field_value(const std::wstring &) { + after_field_value_string(); } void BaseExpression::after_field_value(const std::string &) { + after_field_value_string(); } void BaseExpression::before_field_value(const wchar_t *) { + before_field_value_string(); } void BaseExpression::after_field_value(const wchar_t *) { + after_field_value_string(); } void BaseExpression::before_field_value(const char *) { + before_field_value_string(); } void BaseExpression::after_field_value(const char *) { + after_field_value_string(); } void BaseExpression::before_field_value(const PT::Date &) { + before_field_value_string(); } void BaseExpression::after_field_value(const PT::Date &) { + after_field_value_string(); } +void BaseExpression::before_field_value(const PT::Space &) +{ + before_field_value_string(); +} + +void BaseExpression::after_field_value(const PT::Space &) +{ + after_field_value_string(); +} void BaseExpression::put_name_value_separator() @@ -543,114 +562,138 @@ void BaseExpression::esc(const PT::WTextStream & val, PT::TextStream & stream) } } -void BaseExpression::put_type(char val, PT::TextStream & stream) +void BaseExpression::esc(const PT::Space & space, PT::TextStream & stream) { - stream << "char"; -} + PT::WTextStream tmp_stream; -void BaseExpression::put_type(unsigned char val, PT::TextStream & stream) -{ - stream << "unsigned char"; + if( space.table.size() > 0 ) + { + tmp_stream.clear(); + } + + space.Serialize(tmp_stream, true); + esc(tmp_stream, stream); } -void BaseExpression::put_type(const std::wstring & val, PT::TextStream & stream) -{ - stream << "text"; -} - -void BaseExpression::put_type(const wchar_t * val, PT::TextStream & stream) -{ - stream << "text"; -} - - -void BaseExpression::put_type(const std::string & val, PT::TextStream & stream) -{ - stream << "text"; -} - -void BaseExpression::put_type(const char * val, PT::TextStream & stream) -{ - stream << "text"; -} - - -void BaseExpression::put_type(bool val, PT::TextStream & stream) -{ - stream << "boolean"; -} - -void BaseExpression::put_type(short val, PT::TextStream & stream) -{ - stream << "short integer"; -} - -void BaseExpression::put_type(unsigned short val, PT::TextStream & stream) -{ - stream << "unsigned short integer"; -} - -void BaseExpression::put_type(int val, PT::TextStream & stream) -{ - stream << "integer"; -} - -void BaseExpression::put_type(unsigned int val, PT::TextStream & stream) -{ - stream << "unsigned integer"; -} - -void BaseExpression::put_type(long val, PT::TextStream & stream) -{ - stream << "long integer"; -} - -void BaseExpression::put_type(unsigned long val, PT::TextStream & stream) -{ - stream << "unsigned long integer"; -} - -void BaseExpression::put_type(long long val, PT::TextStream & stream) -{ - stream << "very long integer"; -} - -void BaseExpression::put_type(unsigned long long val, PT::TextStream & stream) -{ - stream << "unsigned very long integer"; -} - -void BaseExpression::put_type(float val, PT::TextStream & stream) -{ - stream << "float"; -} - -void BaseExpression::put_type(double val, PT::TextStream & stream) -{ - stream << "double"; -} - -void BaseExpression::put_type(long double val, PT::TextStream & stream) -{ - stream << "long double"; -} - -//void BaseExpression::put_type(void* val, PT::TextStream & stream) +//void BaseExpression::put_type(char val, PT::TextStream & stream) //{ +// stream << "char"; +//} +// +//void BaseExpression::put_type(unsigned char val, PT::TextStream & stream) +//{ +// stream << "unsigned char"; +//} +// +// +//void BaseExpression::put_type(const std::wstring & val, PT::TextStream & stream) +//{ +// stream << "text"; +//} +// +//void BaseExpression::put_type(const wchar_t * val, PT::TextStream & stream) +//{ +// stream << "text"; +//} +// +// +//void BaseExpression::put_type(const std::string & val, PT::TextStream & stream) +//{ +// stream << "text"; +//} +// +//void BaseExpression::put_type(const char * val, PT::TextStream & stream) +//{ +// stream << "text"; +//} +// +// +//void BaseExpression::put_type(bool val, PT::TextStream & stream) +//{ +// stream << "boolean"; +//} +// +//void BaseExpression::put_type(short val, PT::TextStream & stream) +//{ +// stream << "short integer"; +//} +// +//void BaseExpression::put_type(unsigned short val, PT::TextStream & stream) +//{ +// stream << "unsigned short integer"; +//} +// +//void BaseExpression::put_type(int val, PT::TextStream & stream) +//{ +// stream << "integer"; +//} +// +//void BaseExpression::put_type(unsigned int val, PT::TextStream & stream) +//{ +// stream << "unsigned integer"; +//} +// +//void BaseExpression::put_type(long val, PT::TextStream & stream) +//{ +// stream << "long integer"; +//} +// +//void BaseExpression::put_type(unsigned long val, PT::TextStream & stream) +//{ +// stream << "unsigned long integer"; +//} +// +//void BaseExpression::put_type(long long val, PT::TextStream & stream) +//{ +// stream << "very long integer"; +//} +// +//void BaseExpression::put_type(unsigned long long val, PT::TextStream & stream) +//{ +// stream << "unsigned very long integer"; +//} +// +//void BaseExpression::put_type(float val, PT::TextStream & stream) +//{ +// stream << "float"; +//} +// +//void BaseExpression::put_type(double val, PT::TextStream & stream) +//{ +// stream << "double"; +//} +// +//void BaseExpression::put_type(long double val, PT::TextStream & stream) +//{ +// stream << "long double"; +//} +// +////void BaseExpression::put_type(void* val, PT::TextStream & stream) +////{ +////} +// +// +//void BaseExpression::put_type(const PT::Date & date, PT::TextStream & stream) +//{ +// stream << "date"; +//} +// +//void BaseExpression::put_type(const Model & model, PT::TextStream & stream) +//{ +// stream << "object"; //} -void BaseExpression::put_type(const PT::Date & date, PT::TextStream & stream) +void BaseExpression::before_field_value_string() { - stream << "date"; } -void BaseExpression::put_type(const Model & model, PT::TextStream & stream) +void BaseExpression::after_field_value_string() { - stream << "object"; } + } diff --git a/src/baseexpression.h b/src/baseexpression.h index f344a06..57c2144 100644 --- a/src/baseexpression.h +++ b/src/baseexpression.h @@ -251,6 +251,7 @@ public: virtual void esc(const PT::Date & date, PT::TextStream & stream); virtual void esc(const PT::TextStream & val,PT::TextStream & stream); virtual void esc(const PT::WTextStream & val,PT::TextStream & stream); + virtual void esc(const PT::Space & space, PT::TextStream & stream); virtual bool is_long_field_name(const wchar_t * field_name); virtual bool is_long_field_name(const PT::TextStream & table_name); @@ -631,6 +632,8 @@ protected: virtual void before_field_value(const PT::Date &); virtual void after_field_value(const PT::Date &); + virtual void before_field_value(const PT::Space &); + virtual void after_field_value(const PT::Space &); template void before_field_value(const FieldValue &) @@ -650,43 +653,51 @@ protected: * put_type for: signed char, wchar_t, char16_t, char32_t * */ - virtual void put_type(char val, PT::TextStream & stream); - virtual void put_type(unsigned char val, PT::TextStream & stream); - - virtual void put_type(const std::wstring & val, PT::TextStream & stream); - virtual void put_type(const wchar_t * val, PT::TextStream & stream); - - virtual void put_type(const std::string & val, PT::TextStream & stream); - virtual void put_type(const char * val, PT::TextStream & stream); - - virtual void put_type(bool val, PT::TextStream & stream); - virtual void put_type(short val, PT::TextStream & stream); - virtual void put_type(unsigned short val, PT::TextStream & stream); - virtual void put_type(int val, PT::TextStream & stream); - virtual void put_type(unsigned int val, PT::TextStream & stream); - virtual void put_type(long val, PT::TextStream & stream); - virtual void put_type(unsigned long val, PT::TextStream & stream); - virtual void put_type(long long val, PT::TextStream & stream); - virtual void put_type(unsigned long long val, PT::TextStream & stream); - virtual void put_type(float val, PT::TextStream & stream); - virtual void put_type(double val, PT::TextStream & stream); - virtual void put_type(long double val, PT::TextStream & stream); +// virtual void put_type(char val, PT::TextStream & stream); +// virtual void put_type(unsigned char val, PT::TextStream & stream); +// +// virtual void put_type(const std::wstring & val, PT::TextStream & stream); +// virtual void put_type(const wchar_t * val, PT::TextStream & stream); +// +// virtual void put_type(const std::string & val, PT::TextStream & stream); +// virtual void put_type(const char * val, PT::TextStream & stream); +// +// virtual void put_type(bool val, PT::TextStream & stream); +// virtual void put_type(short val, PT::TextStream & stream); +// virtual void put_type(unsigned short val, PT::TextStream & stream); +// virtual void put_type(int val, PT::TextStream & stream); +// virtual void put_type(unsigned int val, PT::TextStream & stream); +// virtual void put_type(long val, PT::TextStream & stream); +// virtual void put_type(unsigned long val, PT::TextStream & stream); +// virtual void put_type(long long val, PT::TextStream & stream); +// virtual void put_type(unsigned long long val, PT::TextStream & stream); +// virtual void put_type(float val, PT::TextStream & stream); +// virtual void put_type(double val, PT::TextStream & stream); +// virtual void put_type(long double val, PT::TextStream & stream); //virtual void put_type(void* val, PT::TextStream & stream); - virtual void put_type(const PT::Date & date, PT::TextStream & stream); - virtual void put_type(const Model & model, PT::TextStream & stream); +// virtual void put_type(const PT::Date & date, PT::TextStream & stream); +// virtual void put_type(const Model & model, PT::TextStream & stream); +// +// template +// void put_type(const std::list & model, PT::TextStream & stream) +// { +// stream << "table"; // may just use std::list? +// } +// +// template +// void put_type(const std::vector & model, PT::TextStream & stream) +// { +// stream << "table"; // may just just std::vector? +// } + + +private: + + virtual void before_field_value_string(); + virtual void after_field_value_string(); - template - void put_type(const std::list & model, PT::TextStream & stream) - { - stream << "table"; // may just use std::list? - } - template - void put_type(const std::vector & model, PT::TextStream & stream) - { - stream << "table"; // may just just std::vector? - } }; diff --git a/src/clearer.cpp b/src/clearer.cpp index 8fe9f1c..3075547 100644 --- a/src/clearer.cpp +++ b/src/clearer.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018, Tomasz Sowa + * Copyright (c) 2018-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -139,6 +139,11 @@ void Clearer::clear_value(PT::Date & field_value) field_value.Clear(); } +void Clearer::clear_value(PT::Space & field_value) +{ + field_value.Clear(); +} + void Clearer::clear_model(Model & field_value) { field_value.clear(); diff --git a/src/clearer.h b/src/clearer.h index 9f1efbb..94f9de3 100644 --- a/src/clearer.h +++ b/src/clearer.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018, Tomasz Sowa + * Copyright (c) 2018-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +37,7 @@ #include #include "date/date.h" +#include "space/space.h" namespace morm @@ -68,6 +69,7 @@ public: virtual void clear_value(double & field_value); virtual void clear_value(long double & field_value); virtual void clear_value(PT::Date & field_value); + virtual void clear_value(PT::Space & field_value); virtual void clear_model(Model & field_value); diff --git a/src/dbconnector.cpp b/src/dbconnector.cpp index 8c9a41d..b19c040 100644 --- a/src/dbconnector.cpp +++ b/src/dbconnector.cpp @@ -34,6 +34,7 @@ #include #include +#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; diff --git a/src/dbconnector.h b/src/dbconnector.h index 4c1b8f0..f86e90c 100644 --- a/src/dbconnector.h +++ b/src/dbconnector.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2019, Tomasz Sowa + * Copyright (c) 2018-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,6 +107,7 @@ public: virtual void get_value(const char * value_str, double & field_value); virtual void get_value(const char * value_str, long double & field_value); virtual void get_value(const char * value_str, PT::Date & field_value); + virtual void get_value(const char * value_str, PT::Space & field_value); template diff --git a/src/dbexpression.cpp b/src/dbexpression.cpp index 2d0306c..a0af7ef 100644 --- a/src/dbexpression.cpp +++ b/src/dbexpression.cpp @@ -185,75 +185,13 @@ void DbExpression::put_name_value_separator() void DbExpression::before_field_value_string() { -// if( output_type == MORM_OUTPUT_TYPE_SELECT_COLUMNS || -// output_type == MORM_OUTPUT_TYPE_DB_INSERT || -// output_type == MORM_OUTPUT_TYPE_DB_UPDATE || -// output_type == MORM_OUTPUT_TYPE_DB_PRIMARY_KEY ) - { - (*out_stream) << "'"; - } + (*out_stream) << "'"; } + void DbExpression::after_field_value_string() { -// if( output_type == MORM_OUTPUT_TYPE_SELECT_COLUMNS || -// output_type == MORM_OUTPUT_TYPE_DB_INSERT || -// output_type == MORM_OUTPUT_TYPE_DB_UPDATE || -// output_type == MORM_OUTPUT_TYPE_DB_PRIMARY_KEY ) - { - (*out_stream) << "'"; - } -} - - -void DbExpression::before_field_value(const std::wstring &) -{ - before_field_value_string(); -} - -void DbExpression::after_field_value(const std::wstring &) -{ - after_field_value_string(); -} - -void DbExpression::before_field_value(const std::string &) -{ - before_field_value_string(); -} - -void DbExpression::after_field_value(const std::string &) -{ - after_field_value_string(); -} - -void DbExpression::before_field_value(const wchar_t *) -{ - before_field_value_string(); -} - -void DbExpression::after_field_value(const wchar_t *) -{ - after_field_value_string(); -} - -void DbExpression::before_field_value(const char *) -{ - before_field_value_string(); -} - -void DbExpression::after_field_value(const char *) -{ - after_field_value_string(); -} - -void DbExpression::before_field_value(const PT::Date &) -{ - before_field_value_string(); -} - -void DbExpression::after_field_value(const PT::Date &) -{ - after_field_value_string(); + (*out_stream) << "'"; } diff --git a/src/dbexpression.h b/src/dbexpression.h index 95510df..3fbb890 100644 --- a/src/dbexpression.h +++ b/src/dbexpression.h @@ -88,21 +88,6 @@ protected: void field_before(); - void before_field_value(const std::wstring &); - void after_field_value(const std::wstring &); - - void before_field_value(const std::string &); - void after_field_value(const std::string &); - - void before_field_value(const wchar_t *); - void after_field_value(const wchar_t *); - - void before_field_value(const char *); - void after_field_value(const char *); - - void before_field_value(const PT::Date &); - void after_field_value(const PT::Date &); - void put_name_value_separator(); diff --git a/src/jsonexpression.cpp b/src/jsonexpression.cpp index 692693e..f9cd103 100644 --- a/src/jsonexpression.cpp +++ b/src/jsonexpression.cpp @@ -116,38 +116,6 @@ void JSONExpression::after_field_value_string() } -void JSONExpression::before_field_value(const std::wstring &) -{ - before_field_value_string(); -} - -void JSONExpression::before_field_value(const std::string &) -{ - before_field_value_string(); -} - -void JSONExpression::after_field_value(const std::wstring &) -{ - after_field_value_string(); -} - -void JSONExpression::after_field_value(const std::string &) -{ - after_field_value_string(); -} - -void JSONExpression::before_field_value(const PT::Date &) -{ - before_field_value_string(); -} - -void JSONExpression::after_field_value(const PT::Date &) -{ - after_field_value_string(); -} - - - void JSONExpression::put_name_value_separator() { (*out_stream) << ':'; diff --git a/src/jsonexpression.h b/src/jsonexpression.h index 79a91da..f2091c5 100644 --- a/src/jsonexpression.h +++ b/src/jsonexpression.h @@ -61,15 +61,8 @@ protected: void before_second_part_long_field_name(); void after_second_part_long_field_name(); - void before_field_value(const std::wstring &); - void before_field_value(const std::string &); - void after_field_value(const std::wstring &); - void after_field_value(const std::string &); void put_name_value_separator(); - void before_field_value(const PT::Date &); - void after_field_value(const PT::Date &); - void before_field_value_list(); void after_field_value_list(); diff --git a/src/model.h b/src/model.h index 0e9de17..beaad31 100644 --- a/src/model.h +++ b/src/model.h @@ -42,6 +42,7 @@ #include #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 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 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 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 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 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 diff --git a/src/postgresqlexpression.cpp b/src/postgresqlexpression.cpp index ee70474..5a5b2d7 100644 --- a/src/postgresqlexpression.cpp +++ b/src/postgresqlexpression.cpp @@ -77,65 +77,15 @@ void PostgreSQLExpression::after_second_part_long_field_name() void PostgreSQLExpression::before_field_value_string() { -// if( output_type == MORM_OUTPUT_TYPE_DB_INSERT || -// output_type == MORM_OUTPUT_TYPE_DB_UPDATE || -// output_type == MORM_OUTPUT_TYPE_DB_PRIMARY_KEY ) - { - (*out_stream) << "E'"; - } + (*out_stream) << "E'"; } void PostgreSQLExpression::after_field_value_string() { -// if( output_type == MORM_OUTPUT_TYPE_DB_INSERT || -// output_type == MORM_OUTPUT_TYPE_DB_UPDATE || -// output_type == MORM_OUTPUT_TYPE_DB_PRIMARY_KEY ) - { - (*out_stream) << "'"; - } + (*out_stream) << "'"; } -void PostgreSQLExpression::before_field_value(const std::wstring &) -{ - before_field_value_string(); -} - -void PostgreSQLExpression::after_field_value(const std::wstring &) -{ - after_field_value_string(); -} - -void PostgreSQLExpression::before_field_value(const std::string &) -{ - before_field_value_string(); -} - -void PostgreSQLExpression::after_field_value(const std::string &) -{ - after_field_value_string(); -} - -void PostgreSQLExpression::before_field_value(const wchar_t *) -{ - before_field_value_string(); -} - -void PostgreSQLExpression::after_field_value(const wchar_t *) -{ - after_field_value_string(); -} - -void PostgreSQLExpression::before_field_value(const char *) -{ - before_field_value_string(); -} - -void PostgreSQLExpression::after_field_value(const char *) -{ - after_field_value_string(); -} - void PostgreSQLExpression::esc(char val, PT::TextStream & stream) { diff --git a/src/postgresqlexpression.h b/src/postgresqlexpression.h index 6443e10..873247d 100644 --- a/src/postgresqlexpression.h +++ b/src/postgresqlexpression.h @@ -61,17 +61,6 @@ protected: virtual void before_second_part_long_field_name(); virtual void after_second_part_long_field_name(); - void before_field_value(const std::wstring &); - void after_field_value(const std::wstring &); - - void before_field_value(const std::string &); - void after_field_value(const std::string &); - - void before_field_value(const wchar_t *); - void after_field_value(const wchar_t *); - - void before_field_value(const char *); - void after_field_value(const char *); private: