renamed in Model: map_fields() to fields(), prepare_table() to table()

This commit is contained in:
2021-05-13 03:27:21 +02:00
parent 2ad6c8c258
commit 6eaa9088e5
4 changed files with 48 additions and 53 deletions

View File

@@ -86,20 +86,6 @@ public:
void set_connector(ModelConnector * connector);
ModelConnector * get_connector();
/*
* map fields to names
*
* IMPROVEME rename me to fields() and make protected
*/
virtual void map_fields() = 0;
/*
* IMPROVEME make me protected
*/
virtual void prepare_table();
virtual void table(const wchar_t * table_name);
virtual void table(const wchar_t * schema_name, const wchar_t * table_name);
virtual void to_text(PT::TextStream & stream, ModelData * model_data, bool clear_stream = true, bool dump_mode = false);
virtual void to_text(PT::TextStream & stream, ModelData & model_data, bool clear_stream = true, bool dump_mode = false);
virtual void to_text(PT::TextStream & stream, bool clear_stream = true, bool dump_mode = false);
@@ -145,7 +131,7 @@ public:
model_env = &model_env_local;
model_env->model_work_mode = MORM_MODEL_WORK_MODE_SET_FIELD_VALUE;
model_env->field_index = 0;
prepare_table(); // CHECK ME it is needed to set table name?
table(); // CHECK ME it is needed to set table name?
FieldValueHelper field_value_helper;
field_value_helper.db_field_name = db_field_name;
@@ -157,7 +143,7 @@ public:
helper_tab.push_back(field_value_helper);
model_env->field_value_helper_tab = &helper_tab;
map_fields();
fields();
if( !helper_tab.back().found && model_connector )
{
@@ -189,6 +175,15 @@ protected:
Model(const Model & m);
virtual ~Model();
/*
* the main method of mapping between fields and database resultsets
*/
virtual void fields() = 0;
virtual void table();
virtual void table_name(const wchar_t * table_name);
virtual void table_name(const wchar_t * schema_name, const wchar_t * table_name);
virtual void before_select();
virtual void before_insert();
virtual void before_update();
@@ -683,7 +678,7 @@ protected:
child_model.model_env = &model_env_local;
child_model.model_env->has_primary_key_set = child_model.has_primary_key_set;
child_model.set_connector(model_connector);
child_model.prepare_table();
child_model.table();
if( model_env->model_work_submode == MORM_MODEL_WORK_SUBMODE_INSERT )
{