fixed #2: escape tables/columns names in Finder left join queries

some methods moved from model.h to model.cpp and from baseexpression.h to baseexpression.cpp
This commit is contained in:
2021-05-12 00:27:35 +02:00
parent 009955a0fd
commit c7797ff2f1
5 changed files with 678 additions and 520 deletions

View File

@@ -60,6 +60,9 @@ public:
virtual void set_work_mode(int work_mode);
virtual int get_work_mode();
virtual PT::TextStream * get_text_stream();
virtual void set_text_stream(PT::TextStream * out_stream);
virtual void clear();
virtual void generate_from_model(PT::TextStream & stream, Model & model);
@@ -220,67 +223,23 @@ public:
}
void table_to_stream(PT::TextStream & stream, const wchar_t * schema_name, const wchar_t * table_name, ModelEnv * model_env)
{
this->out_stream = &stream;
//table(table_name, model_env);
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);
virtual void put_table(const PT::WTextStream & table_name);
virtual void put_table_with_index(const wchar_t * table_name, int index);
virtual void put_table_with_index(const PT::WTextStream & table_name, int index);
virtual void put_table_with_index_and_field(const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void put_table_with_index_and_field(const PT::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type);
before_first_part_long_field_name();
esc(schema_name, *out_stream);
after_first_part_long_field_name();
(*out_stream) << '.';
before_second_part_long_field_name();
esc(table_name, *out_stream);
after_second_part_long_field_name();
this->out_stream = nullptr;
}
void table_to_stream(PT::TextStream & stream, const PT::WTextStream & schema_name, const PT::WTextStream & table_name, ModelEnv * model_env)
{
this->out_stream = &stream;
//table(table_name, model_env);
before_first_part_long_field_name();
esc(schema_name, *out_stream);
after_first_part_long_field_name();
(*out_stream) << '.';
before_second_part_long_field_name();
esc(table_name, *out_stream);
after_second_part_long_field_name();
this->out_stream = nullptr;
}
void table_to_stream(PT::TextStream & stream, const wchar_t * table_name, ModelEnv * model_env)
{
this->out_stream = &stream;
//table(table_name, model_env);
if( is_long_field_name(table_name) )
put_long_field_name(table_name);
else
put_short_field_name(table_name, model_env);
this->out_stream = nullptr;
}
void table_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, ModelEnv * model_env)
{
this->out_stream = &stream;
//table(table_name, model_env);
before_short_field_name();
esc(table_name, *out_stream);
after_short_field_name();
this->out_stream = nullptr;
}
virtual void schema_table_to_stream(PT::TextStream & stream, const wchar_t * schema_name, const wchar_t * table_name);
virtual void schema_table_to_stream(PT::TextStream & stream, const PT::WTextStream & schema_name, const PT::WTextStream & table_name);
virtual void table_to_stream(PT::TextStream & stream, const wchar_t * table_name);
virtual void table_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name);
virtual void table_with_index_to_stream(PT::TextStream & stream, const wchar_t * table_name, int index);
virtual void table_with_index_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, int index);
virtual void table_with_index_and_field_to_stream(PT::TextStream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type);
virtual void table_with_index_and_field_to_stream(PT::TextStream & stream, const PT::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type);
/*
@@ -340,6 +299,7 @@ protected:
virtual void field_after();
virtual void put_field_name(const wchar_t * field_name, FT field_type, ModelEnv * model_env);
virtual void save_foreign_key(const wchar_t * field_name, FT field_type, ModelEnv * model_env);
virtual void dump_additional_info(Model & model);