fix: correctly use a table name when using Finder::use_table_prefix(true)
We cannot use aliases in the form of "tablename"."fieldname" - now it was changed to "tablename.fieldname". Sample how to get the id field, assuming the table name is 'mymodel'. mymodel = finder2. select(morm::Select::no_auto_generated_columns). use_table_prefix(true). raw("SELECT id AS \"mymodel.id\""). raw("FROM mymodel"). raw("WHERE id = 25"). get(); In addition, there was an error that the table name was not correctly set for the first object in the hierarchy - it was empty, e.g. ""."field_name"
This commit is contained in:
@@ -241,6 +241,8 @@ public:
|
||||
virtual void put_table_with_index_and_field(const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type);
|
||||
virtual void put_table_and_field(const wchar_t * table_name, const wchar_t * field_name, const FT & field_type);
|
||||
virtual void put_table_and_field(const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type);
|
||||
virtual void put_alias(const pt::WTextStream & alias_name, int index);
|
||||
virtual void put_alias(const pt::WTextStream & alias_name_prefix, int index, const wchar_t * alias_name_postfix);
|
||||
|
||||
virtual void put_string(const char * str, const FT & field_type, bool add_quotes = false);
|
||||
virtual void put_string(const wchar_t * str, const FT & field_type, bool add_quotes = false);
|
||||
@@ -259,6 +261,8 @@ public:
|
||||
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);
|
||||
virtual void table_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type);
|
||||
virtual void table_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type);
|
||||
virtual void alias_to_stream(pt::TextStream & stream, const pt::WTextStream & alias_name, int index);
|
||||
virtual void alias_to_stream(pt::TextStream & stream, const pt::WTextStream & alias_name_prefix, int index, const wchar_t * alias_name_postfix);
|
||||
|
||||
virtual void string_to_stream(pt::TextStream & stream, const char * str, const FT & field_type, bool add_quotes = false);
|
||||
virtual void string_to_stream(pt::TextStream & stream, const wchar_t * str, const FT & field_type, bool add_quotes = false);
|
||||
@@ -599,6 +603,7 @@ protected:
|
||||
|
||||
virtual void schema_table_separator();
|
||||
virtual void table_field_separator();
|
||||
virtual void alias_names_separator();
|
||||
|
||||
virtual void before_schema_name();
|
||||
virtual void after_schema_name();
|
||||
@@ -609,6 +614,8 @@ protected:
|
||||
virtual void before_field_name();
|
||||
virtual void after_field_name();
|
||||
|
||||
virtual void before_alias_name();
|
||||
virtual void after_alias_name();
|
||||
|
||||
virtual void before_field_value(const std::wstring &, const FT & field_type, ModelEnv * model_env);
|
||||
virtual void after_field_value(const std::wstring &, const FT & field_type, ModelEnv * model_env);
|
||||
|
Reference in New Issue
Block a user