add possibility to set save status for the whole tree
add method: void Model::set_save_mode2(SaveMode save_mode, bool update_whole_tree = true) in the future it may be renamed to set_save_mode()
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018-2021, Tomasz Sowa
|
||||
* Copyright (c) 2018-2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -74,6 +74,21 @@ Model::SaveMode Model::get_save_mode()
|
||||
}
|
||||
|
||||
|
||||
void Model::set_save_mode2(SaveMode save_mode, bool update_whole_tree)
|
||||
{
|
||||
this->save_mode = save_mode;
|
||||
|
||||
if( update_whole_tree )
|
||||
{
|
||||
ModelEnv model_env_local;
|
||||
model_env = &model_env_local;
|
||||
model_env->model_work_mode = MORM_MODEL_WORK_MODE_PROPAGATE_SAVE_STATUS;
|
||||
fields();
|
||||
model_env = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Model::set_has_primary_key_set(bool has_primary_key)
|
||||
{
|
||||
this->has_primary_key_set = has_primary_key;
|
||||
@@ -1578,6 +1593,11 @@ void Model::field_model(const wchar_t * db_field_name, const wchar_t * flat_fiel
|
||||
}
|
||||
}
|
||||
|
||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_PROPAGATE_SAVE_STATUS )
|
||||
{
|
||||
field_model.set_save_mode2(save_mode, true);
|
||||
}
|
||||
|
||||
field_model.model_env = nullptr;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user