added: to Model::to_text() methods added dump_mode (bool) parameter

an additional field (model_save_mode) is printed
changed: if there is no an object the Cursor returns a Model with DO_NOTHING_ON_SAVE flag now
         (DO_INSERT_ON_SAVE was beforehand)
fixed:   when reading a result from db: for auto generated select there should be used
         get_value_by_field_index() method instead of get_value_by_field_name() 
changed: flat string (json) is generated only if a model has DO_INSERT_ON_SAVE
         or DO_UPDATE_ON_SAVE or is dump_mode turn on
         




git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1208 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2019-09-13 18:17:02 +00:00
parent c133e949ce
commit 057d879b4c
9 changed files with 81 additions and 31 deletions

View File

@@ -124,7 +124,7 @@ bool Model::found()
}
void Model::to_text(PT::TextStream & stream, ModelData * model_data, bool clear_stream)
void Model::to_text(PT::TextStream & stream, ModelData * model_data, bool clear_stream, bool dump_mode)
{
if( clear_stream )
{
@@ -135,6 +135,7 @@ void Model::to_text(PT::TextStream & stream, ModelData * model_data, bool clear_
model_env = &model_env_local;
model_env->model_connector_mode = MORM_MODEL_CONNECTOR_MODE_GENERATING_FLAT_STRING;
model_env->dump_mode = dump_mode;
if( model_connector )
{
@@ -153,20 +154,20 @@ void Model::to_text(PT::TextStream & stream, ModelData * model_data, bool clear_
}
void Model::to_text(PT::TextStream & stream, ModelData & model_data, bool clear_stream)
void Model::to_text(PT::TextStream & stream, ModelData & model_data, bool clear_stream, bool dump_mode)
{
to_text(stream, &model_data, clear_stream);
to_text(stream, &model_data, clear_stream, dump_mode);
}
void Model::to_text(PT::TextStream & stream, bool clear_stream)
void Model::to_text(PT::TextStream & stream, bool clear_stream, bool dump_mode)
{
to_text(stream, nullptr, clear_stream);
to_text(stream, nullptr, clear_stream, dump_mode);
}
void Model::to_text(std::string & str, ModelData * model_data, bool clear_string)
void Model::to_text(std::string & str, ModelData * model_data, bool clear_string, bool dump_mode)
{
if( model_connector )
{
@@ -175,22 +176,22 @@ void Model::to_text(std::string & str, ModelData * model_data, bool clear_string
if( out_stream )
{
to_text(*out_stream, model_data, true);
to_text(*out_stream, model_data, true, dump_mode);
out_stream->to_string(str, clear_string);
}
}
}
void Model::to_text(std::string & str, ModelData & model_data, bool clear_string)
void Model::to_text(std::string & str, ModelData & model_data, bool clear_string, bool dump_mode)
{
to_text(str, &model_data, clear_string);
to_text(str, &model_data, clear_string, dump_mode);
}
void Model::to_text(std::string & str, bool clear_string)
void Model::to_text(std::string & str, bool clear_string, bool dump_mode)
{
to_text(str, nullptr, clear_string);
to_text(str, nullptr, clear_string, dump_mode);
}