fix: correctly escape output stream buffer for models getters
This commit is contained in:
parent
21117e24c0
commit
1ace47266d
|
@ -44,6 +44,10 @@ namespace morm
|
|||
|
||||
BaseExpression::BaseExpression()
|
||||
{
|
||||
/*
|
||||
* may it would be better for the ModelConnector/JSONConnector/PostgreSQLConnector to provide one scratch buffer?
|
||||
*/
|
||||
scratch_buffer = &scratch_buffer_local;
|
||||
clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,9 @@ public:
|
|||
BaseExpression();
|
||||
virtual ~BaseExpression();
|
||||
|
||||
BaseExpression(const BaseExpression &) = delete;
|
||||
BaseExpression(BaseExpression &&) = delete;
|
||||
|
||||
virtual void set_work_mode(int work_mode);
|
||||
virtual int get_work_mode();
|
||||
|
||||
|
@ -313,10 +316,10 @@ protected:
|
|||
|
||||
int work_mode; /* what to do: generating fields list, values list or fields-values list */
|
||||
bool is_first_field;
|
||||
|
||||
pt::TextStream * out_stream;
|
||||
|
||||
bool use_prefix;
|
||||
pt::TextStream scratch_buffer_local;
|
||||
pt::TextStream * scratch_buffer;
|
||||
|
||||
virtual void generate_from_model(Model & model);
|
||||
|
||||
|
@ -348,7 +351,15 @@ protected:
|
|||
if( out_stream && model_env && model_env->model && getter_method )
|
||||
{
|
||||
before_field_value_string(field_type);
|
||||
(model_env->model->*getter_method)(*out_stream);
|
||||
|
||||
if( scratch_buffer )
|
||||
{
|
||||
scratch_buffer->clear();
|
||||
(model_env->model->*getter_method)(*scratch_buffer);
|
||||
esc(*scratch_buffer, *out_stream, field_type);
|
||||
scratch_buffer->clear();
|
||||
}
|
||||
|
||||
after_field_value_string(field_type);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue