in BaseExpression: changed the way how field names are escaped:

methods removed:
  virtual void before_field_name();
  virtual void after_field_name();
methods added:
  virtual void before_short_field_name();
  virtual void after_short_field_name();
  they are used for escaping column names in a case when using short form - just only column_name
  e.g.: [before_short_field_name]column_name[after_short_field_name]
methods added:
  virtual void before_first_part_long_field_name();
  virtual void after_first_part_long_field_name();
  virtual void before_second_part_long_field_name();
  virtual void after_second_part_long_field_name();
  they are used for escaping column names in a case when using long form: table_name.column_name
  e.g.: [before_first_part_long_field_name]table_name[after_first_part_long_field_name].[before_second_part_long_field_name]column_name[after_second_part_long_field_name]
methods added:
  virtual void esc(wchar_t val, PT::TextStream & stream);
This commit is contained in:
2021-02-24 01:15:17 +01:00
parent 0843e384eb
commit ff551a64b8
7 changed files with 209 additions and 47 deletions

View File

@@ -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
@@ -212,6 +212,8 @@ public:
virtual void esc(char val, PT::TextStream & stream);
virtual void esc(unsigned char val, PT::TextStream & stream);
virtual void esc(wchar_t val, PT::TextStream & stream);
virtual void esc(const std::wstring & val, PT::TextStream & stream);
virtual void esc(const wchar_t * val, PT::TextStream & stream);
@@ -262,8 +264,6 @@ protected:
//void field(const wchar_t * field_name, Model & field, bool insertable = true, bool updatable = true);
virtual bool need_to_add_field_prefix(const wchar_t * field_name);
virtual void put_field_name(const wchar_t * field_name, ModelEnv * model_env);
virtual void save_foreign_key(const wchar_t * field_name, ModelEnv * model_env);
@@ -580,8 +580,26 @@ protected:
}
virtual void before_field_name();
virtual void after_field_name();
/*
* escaping column names in a case when using short form - just only column_name
* [before_short_field_name]column_name[after_short_field_name]
*/
virtual void before_short_field_name();
virtual void after_short_field_name();
/*
* escaping column names in a case when using long form: table_name.column_name
* [before_first_part_long_field_name]table_name[after_first_part_long_field_name].[before_second_part_long_field_name]column_name[after_second_part_long_field_name]
*
*/
virtual void before_first_part_long_field_name();
virtual void after_first_part_long_field_name();
virtual void before_second_part_long_field_name();
virtual void after_second_part_long_field_name();
virtual const wchar_t * put_long_part_field_name(const wchar_t * field_name);
virtual void put_long_field_name(const wchar_t * field_name);
virtual void put_short_field_name(const wchar_t * field_name, ModelEnv * model_env);
virtual void before_field_value(const std::wstring &);
virtual void after_field_value(const std::wstring &);