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:
2023-07-15 03:08:02 +02:00
parent e7c62e35dc
commit 6619f3ecb5
7 changed files with 111 additions and 6 deletions

View File

@@ -90,6 +90,7 @@ protected:
void schema_table_separator();
void table_field_separator();
void alias_names_separator();
void before_schema_name();
void after_schema_name();
@@ -100,6 +101,9 @@ protected:
void before_field_name();
void after_field_name();
void before_alias_name();
void after_alias_name();
void add_additional_columns(Model & model);
void before_field_value_string(const FT & field_type, ModelEnv * model_env);