diff --git a/src/baseexpression.cpp b/src/baseexpression.cpp index b37ad9f..3499f47 100644 --- a/src/baseexpression.cpp +++ b/src/baseexpression.cpp @@ -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(); - if( !column_prefix.empty() ) + if( add_column_prefix && !column_prefix.empty() ) { esc(column_prefix, *out_stream); (*out_stream) << '.'; diff --git a/src/baseexpression.h b/src/baseexpression.h index 509084c..13c4a88 100644 --- a/src/baseexpression.h +++ b/src/baseexpression.h @@ -62,7 +62,7 @@ public: virtual void generate_from_model(PT::TextStream & stream, Model & model); template - 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) ) { @@ -70,7 +70,7 @@ public: if( work_mode == MORM_WORK_MODE_MODEL_FIELDS ) { - put_field_name(field_name); + put_field_name(field_name, add_column_prefix); } else if( work_mode == MORM_WORK_MODE_MODEL_VALUES ) @@ -90,12 +90,12 @@ public: } template - 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 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 @@ -245,7 +245,7 @@ protected: //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 void put_field_value(const FieldValue & field_value) diff --git a/src/dbexpression.h b/src/dbexpression.h index f9b5341..3de17b7 100644 --- a/src/dbexpression.h +++ b/src/dbexpression.h @@ -68,7 +68,7 @@ public: PT::TextStream column_expression; 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); }