Commit Graph

10 Commits

Author SHA1 Message Date
Tomasz Sowa 133a45c84b Added flag has_primary_key_set to Model
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)
2021-03-09 18:10:34 +01:00
Tomasz Sowa 334201fe15 fixed: a parent key was not properly set to simple childs (insert statements)
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
2019-09-24 17:08:45 +00:00
Tomasz Sowa cff4c1518e added support for UPDATE, INSERT and REMOVE for lists childs
(need some testing)




git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1214 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-09-24 11:09:11 +00:00
Tomasz Sowa ba5f702257 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
2019-09-18 12:29:20 +00:00
Tomasz Sowa afce2234c3 fixed: get_value_by_field_name() is able to correctly take values when
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
2019-09-17 17:55:39 +00:00
Tomasz Sowa 057d879b4c 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
2019-09-13 18:17:02 +00:00
Tomasz Sowa 0be9feda44 added support in Model for removing the whole tree
(without lists/vectors at the moment yet)




git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1206 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-09-05 16:32:35 +00:00
Tomasz Sowa d2f851faf9 now Model.update() and Model.insert() can update/insert the whole tree with child models
(at the moment without lists/vectors only model childs)



git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1205 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-09-04 16:02:18 +00:00
Tomasz Sowa 7ff05f493c added: to Model: virtual void set_parent_key_in_childs()
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
2019-08-22 18:33:35 +00:00
Tomasz Sowa 074be938ca added 'samples' directory for samples and tests
git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1202 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-08-21 15:59:03 +00:00