fixed: in 'left join' statements there were not table indices used

added: now we set flag save_mode = DO_NOTHING_ON_SAVE for objects for which
       all fields from a database result set are null



git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1210 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2019-09-18 12:29:20 +00:00
parent afce2234c3
commit ba5f702257
11 changed files with 126 additions and 62 deletions

View File

@@ -622,8 +622,18 @@ void Model::map_values_from_query()
if( model_env )
{
model_env->model_connector_mode = MORM_MODEL_CONNECTOR_MODE_READING_VALUE_FROM_DB_RESULTSET;
model_env->all_fields_are_null = true;
map_fields();
model_env->model_connector_mode = MORM_MODEL_CONNECTOR_MODE_NONE;
if( model_env->all_fields_are_null )
{
save_mode = DO_NOTHING_ON_SAVE;
}
else
{
save_mode = DO_UPDATE_ON_SAVE;
}
}
}
@@ -774,5 +784,20 @@ void Model::prepare_table_names(bool prepare_table_index)
}
}
void Model::put_table_name_with_index(PT::TextStream & str)
{
if( model_env )
{
str << model_env->table_name_short;
if( model_env->table_index > 1 )
{
str << model_env->table_index;
}
}
}
} // namespace