changed: don't use column prefix in add_field_for_select()

git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1107 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2018-05-02 12:55:00 +00:00
parent e25b6d9a29
commit 6fc4e23e44
3 changed files with 8 additions and 8 deletions

View File

@ -123,11 +123,11 @@ void BaseExpression::field_after()
} }
void BaseExpression::put_field_name(const wchar_t * field_name) void BaseExpression::put_field_name(const wchar_t * field_name, bool add_column_prefix)
{ {
before_field_name(); before_field_name();
if( !column_prefix.empty() ) if( add_column_prefix && !column_prefix.empty() )
{ {
esc(column_prefix, *out_stream); esc(column_prefix, *out_stream);
(*out_stream) << '.'; (*out_stream) << '.';

View File

@ -62,7 +62,7 @@ public:
virtual void generate_from_model(PT::TextStream & stream, Model & model); virtual void generate_from_model(PT::TextStream & stream, Model & model);
template<typename FieldValue> template<typename FieldValue>
void field(const wchar_t * field_name, const FieldValue & field_value, bool insertable = true, bool updatable = true, bool is_primary_key = false) void field(const wchar_t * field_name, const FieldValue & field_value, bool insertable = true, bool updatable = true, bool is_primary_key = false, bool add_column_prefix = true)
{ {
if( out_stream && can_field_be_generated(insertable, updatable, is_primary_key) ) if( out_stream && can_field_be_generated(insertable, updatable, is_primary_key) )
{ {
@ -70,7 +70,7 @@ public:
if( work_mode == MORM_WORK_MODE_MODEL_FIELDS ) if( work_mode == MORM_WORK_MODE_MODEL_FIELDS )
{ {
put_field_name(field_name); put_field_name(field_name, add_column_prefix);
} }
else else
if( work_mode == MORM_WORK_MODE_MODEL_VALUES ) if( work_mode == MORM_WORK_MODE_MODEL_VALUES )
@ -90,12 +90,12 @@ public:
} }
template<typename FieldValue> template<typename FieldValue>
void field(const PT::TextStream & field_name, const FieldValue & field_value, bool insertable = true, bool updatable = true, bool is_primary_key = false) void field(const PT::TextStream & field_name, const FieldValue & field_value, bool insertable = true, bool updatable = true, bool is_primary_key = false, bool add_column_prefix = true)
{ {
std::wstring field_name_str; // field() methods can be called recursively, so don't make it as class object std::wstring field_name_str; // field() methods can be called recursively, so don't make it as class object
field_name.to_string(field_name_str); field_name.to_string(field_name_str);
return field(field_name_str.c_str(), field_value, insertable, updatable, is_primary_key); return field(field_name_str.c_str(), field_value, insertable, updatable, is_primary_key, add_column_prefix);
} }
template<typename FieldValue> template<typename FieldValue>
@ -245,7 +245,7 @@ protected:
//void field(const wchar_t * field_name, Model & field, bool insertable = true, bool updatable = true); //void field(const wchar_t * field_name, Model & field, bool insertable = true, bool updatable = true);
virtual void put_field_name(const wchar_t * field_name); virtual void put_field_name(const wchar_t * field_name, bool add_column_prefix = true);
template<typename FieldValue> template<typename FieldValue>
void put_field_value(const FieldValue & field_value) void put_field_value(const FieldValue & field_value)

View File

@ -68,7 +68,7 @@ public:
PT::TextStream column_expression; PT::TextStream column_expression;
column_expression << new_column_expression << " as " << new_column_name; column_expression << new_column_expression << " as " << new_column_name;
field(column_expression, field_value, false, false); field(column_expression, field_value, false, false, false, false);
} }