- changed in Model::field_list_generic(...): message "you should set FT::is_foreign_key or FT::is_foreign_key_in_child flag" print only
for work mode MORM_MODEL_WORK_MODE_SET_PARENT_ID or MORM_MODEL_WORK_MODE_ITERATE_THROUGH_CHILDS_WITHOUT_FOREIGN_KEY
- pt::TextStream::to_string(...) is now pt::TextStream::to_str(...)
- in Model::get_raw_value() for ezc 'pt::TextStream & stream' changed to 'pt::Stream & stream' (a base class of pt::TextStream)
similar in field(...) methods which take getters: void (Model::*getter_method)(pt::TextStream &) -> void (Model::*getter_method)(pt::Stream &)
added to Model:
- method field() which can take a pointer to a member which returns bool:
void field(const wchar_t * field_name, bool (ClassName::*method)(), const morm::FT & field_type = morm::FT::default_type)
- method field() which can take a pointer to a member which can set morm::ModelWrapper object
void field(const wchar_t * field_name, void (ClassName::*method)(morm::ModelWrapper **), const morm::FT & field_type = morm::FT::default_type)
- methods: bool Model::convert_to_bool(...) - they are used for creating a result for ezc from local fields
- removed MORM_WORK_MODE_GET_SPECIFIC_FIELD_VALUE from expression work mode
- removed: void BaseExpression::field(const wchar_t * field_name, void (Model::*getter_method)(pt::TextStream &), const FT & field_type, ModelEnv * model_env)
- removed from BaseExpression: template<typename FunInfoStreamType> void field(const wchar_t * field_name, void (Model::*fun)(Ezc::FunInfo<FunInfoStreamType> &), const FT & field_type, ModelEnv * model_env)
- removed: void FlatConnector::to_text(const wchar_t * flat_field_name, pt::TextStream & stream, Model & model)
- renamed/changed: Model::put_field_value(...) -> Model::get_raw_value()
added classes:
class ModelWrapper - base wrapper class for a model or a model container
class ModelWrapperModel : public ModelWrapper - wrapper for a model
template<typename VectorType> class ModelWrapperVector : public ModelWrapper - wrapper for vector of models
template<typename ListType> class ModelWrapperList : public ModelWrapper - wrapper for list of models
ModelWrapper... classes are used by ezc library for iterating through child models and for iterating in [for...] statements
added to Model:
Model * get_model(const wchar_t * db_field_name, const wchar_t * flat_field_name, bool put_log_if_not_found = true);
ModelWrapper * get_model_wrapper(const wchar_t * db_field_name, const wchar_t * flat_field_name, bool put_log_if_not_found = true);
those functions can be used with databases and flat files
- removed support for calling static function
- if MORM_HAS_EZC_LIBRARY macro is defined then we can call a function
which has a first argument Ezc::FunInfo<>& object
(only for generating flat files)
FT class has following types:
enum FieldType
{
default_type = 0,
primary_key = 1,
foreign_key = 2,
foreign_key_in_child = 4,
no_insertable = 8,
no_updatable = 16,
no_fetchable = 32, /* not supported yet */
};
an object of FT class are now used in Model::field() methods instead of insertable/updatable/is_primary_key/... boolean flags
changed the semantic of has_foreign_key (which was a bool) flag in child Models:
now on Models and list/vector of Models you should use either FT::foreign_key or FT::foreign_key_in_child
1. FT::foreign_key means that field with this flag is a foreign key and is pointing to the child object
(it was the case when has_foreign_key was equal to true beforehand)
2. FT::foreign_key_in child means that the foreign key is in the child object and is pointing to the parent object
Now we know whether the primary key is defined or not
and we do not allow to make update/remove if the key is not defined.
And when doing insert/update we can put NULL if child models don't have
the primary key set (fields with has_foreign_key set to true).
Now in after_select() we should also set has_primary_key_set flag
or just call get_last_sequence_for_primary_key instead of get_last_sequence.
fixed: added prefix +00 when serializing PT::Date to PostgreSQL (time zone)
(for a column with a time zone there was a wrong value saved)
fixed: compilation erorr when inserting/updating a Model object which has child lists without Model objects such as std::list<int>
added: to Model: methods insert, update, remove and save with one argument: bool save_whole_tree
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1217 e52654a7-88a9-db11-a3e9-0013d4bc506e
fixed: a parent key was not set in list of childs (insert statements)
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1215 e52654a7-88a9-db11-a3e9-0013d4bc506e
we can use our own class (based on FlatConnector and FlatExpression) to generate documentation
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1213 e52654a7-88a9-db11-a3e9-0013d4bc506e
added: ModelEnv::model_connector_submode (used in iterating through childs)
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1211 e52654a7-88a9-db11-a3e9-0013d4bc506e
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
we do not use auto generated 'select' and when we are using prefixes for columns
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1209 e52654a7-88a9-db11-a3e9-0013d4bc506e
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
for setting a parent key id in child models,
it is called after after_insert() method
added: SetFieldValueHelper class used for storing primary key values from a parent model
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1204 e52654a7-88a9-db11-a3e9-0013d4bc506e
similarly in generate_update_query and generate_remove_query
added: support std::vector<> in Model::field() methods
added: serializing std::vector and std::list for non-model classes in BaseExpression
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1200 e52654a7-88a9-db11-a3e9-0013d4bc506e
added BaseExpression::need_to_add_field_prefix()
now the fields() methods don't take add_column_prefix parameter
but the field_name (wchar_t*) is tested whether is it a long (with a period) or short name
added BaseExpression::save_foreign_key() (code moved from field())
removed some default method arguments from BaseExpression
added neq() method for Finder
added DbExpression::prepare_short_table_name(const PT::TextStream & table_name, PT::TextStream & short_table_name)
git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1194 e52654a7-88a9-db11-a3e9-0013d4bc506e
(this was for a custom prefix)
- removed column_prefix and column_prefix_index from BaseExpression
now we have a pointer to ModelEnv passed in field() method
- to ModelEnv: added table_name, table_name_simple and table_index
git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1193 e52654a7-88a9-db11-a3e9-0013d4bc506e
- added FinderHelper class - used as a global object for the whole model tree in Finder
(some fields moved from ModelData)
- added CursorHelper class - used as a global object for the whole model tree in Cursor
(some fields moved from ModelData)
git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1192 e52654a7-88a9-db11-a3e9-0013d4bc506e
added: ModelEnv class - now Model has a pointer to ModelEnv
and ModelEnv has a pointer to ModelData, model_connector_mode, table_index and doc_field_pointer
git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1191 e52654a7-88a9-db11-a3e9-0013d4bc506e
(the primary key should consist of only one column at the moment)
git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1186 e52654a7-88a9-db11-a3e9-0013d4bc506e
added: using ModelData in BaseExpression so Model::to_text() functions can use a ModelData object now
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1175 e52654a7-88a9-db11-a3e9-0013d4bc506e
changed: model connector is propagated to childs when needed
(when update, insert, save, to_text is called or in finder)
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1120 e52654a7-88a9-db11-a3e9-0013d4bc506e
now in Model we have field() methods for other Model or std::list<Model>
(code not tested)
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1118 e52654a7-88a9-db11-a3e9-0013d4bc506e