- removed prefix() method from Finder

(this was for a custom prefix)
- removed column_prefix and column_prefix_index from BaseExpression
  now we have a pointer to ModelEnv passed in field() method
- to ModelEnv: added table_name, table_name_simple and table_index





git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1193 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2019-05-21 17:24:12 +00:00
parent 958e89fb02
commit a1d18735b0
9 changed files with 94 additions and 148 deletions

View File

@@ -68,8 +68,6 @@ int BaseExpression::get_work_mode()
void BaseExpression::prepare_to_new_expression()
{
column_prefix.clear();
column_prefix_index = 1;
out_stream = nullptr;
is_first_field = false;
work_mode = 0;
@@ -89,25 +87,9 @@ void BaseExpression::allow_to_use_prefix(bool use_prefix)
}
void BaseExpression::set_column_prefix(const std::string & prefix)
bool BaseExpression::get_allow_to_use_prefix()
{
column_prefix = prefix;
}
void BaseExpression::set_column_prefix(const std::string & prefix, int index)
{
column_prefix = prefix;
column_prefix_index = index;
}
std::string BaseExpression::get_column_prefix()
{
return column_prefix;
}
int BaseExpression::get_column_prefix_index()
{
return column_prefix_index;
return use_prefix;
}
@@ -177,16 +159,18 @@ void BaseExpression::field_after()
void BaseExpression::put_field_name(const wchar_t * field_name, bool add_column_prefix)
void BaseExpression::put_field_name(const wchar_t * field_name, bool add_column_prefix, ModelEnv * model_env)
{
before_field_name();
if( use_prefix && add_column_prefix && !column_prefix.empty() )
if( use_prefix && model_env && add_column_prefix )
{
esc(column_prefix, *out_stream);
esc(model_env->table_name_simple, *out_stream);
if( column_prefix_index > 1 )
(*out_stream) << column_prefix_index;
if( model_env->table_index > 1 )
{
(*out_stream) << model_env->table_index;
}
(*out_stream) << '.';
}
@@ -415,6 +399,16 @@ void BaseExpression::esc(const PT::Date & date, PT::TextStream & stream)
stream << date;
}
void BaseExpression::esc(const PT::TextStream & val, PT::TextStream & stream)
{
PT::TextStream::const_iterator i = val.begin();
for(; i != val.end() ; ++i)
{
esc(*i, stream);
}
}
void BaseExpression::put_type(char val, PT::TextStream & stream)
{