fixed: generating a correct table names with indices for JOIN statements and column prefixes
git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1188 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -69,9 +69,11 @@ 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;
|
||||
use_prefix = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,16 +83,35 @@ PT::TextStream * BaseExpression::get_current_stream()
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::allow_to_use_prefix(bool use_prefix)
|
||||
{
|
||||
this->use_prefix = use_prefix;
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::set_column_prefix(const std::string & 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BaseExpression::generate_from_model(PT::TextStream & stream, Model & model)
|
||||
{
|
||||
this->out_stream = &stream;
|
||||
@@ -156,24 +177,17 @@ void BaseExpression::field_after()
|
||||
|
||||
|
||||
|
||||
void BaseExpression::put_field_name(int table_index, const wchar_t * field_name, bool add_column_prefix)
|
||||
void BaseExpression::put_field_name(const wchar_t * field_name, bool add_column_prefix)
|
||||
{
|
||||
before_field_name();
|
||||
|
||||
// if( !add_column_prefix )
|
||||
// {
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if( table_index >= 0 )
|
||||
// {
|
||||
// (*out_stream) << 't' << table_index << '.';
|
||||
// }
|
||||
|
||||
if( add_column_prefix && !column_prefix.empty() )
|
||||
if( use_prefix && add_column_prefix && !column_prefix.empty() )
|
||||
{
|
||||
esc(column_prefix, *out_stream);
|
||||
|
||||
if( column_prefix_index > 1 )
|
||||
(*out_stream) << column_prefix_index;
|
||||
|
||||
(*out_stream) << '.';
|
||||
}
|
||||
|
||||
@@ -182,12 +196,6 @@ void BaseExpression::put_field_name(int table_index, const wchar_t * field_name,
|
||||
}
|
||||
|
||||
|
||||
void BaseExpression::put_field_name(const wchar_t * field_name, bool add_column_prefix)
|
||||
{
|
||||
put_field_name(-1, field_name, add_column_prefix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BaseExpression::put_field_doc(Model & model, const void * field_pointer, bool insertable, bool updatable, bool is_primary_key, ModelData * model_data)
|
||||
{
|
||||
|
Reference in New Issue
Block a user