Commit Graph

17 Commits

Author SHA1 Message Date
Tomasz Sowa 86177889af
add a CSVConnector/CSVExpression classes to serialize to csv format
Current limitation: list/vectors are not serialized.

while here:
- move the output_type flag from the DbExpression to BaseExpression class
- add Model::to_text(...) methods with an Export parameter
2023-04-12 17:20:29 +02:00
Tomasz Sowa dee48ea2b5
use an <item> field when serializing a table to xml 2023-02-27 00:29:51 +01:00
Tomasz Sowa 8373f9e9d8 make depend 2022-07-30 03:32:33 +02:00
Tomasz Sowa 43dfbd5d5a add possibility of calculating how many rows there were before LIMIT was applied
The Finder has get_rows_counter() method which returns how many rows there were
before LIMIT clause was applied. The select(...) method should be called with
Select::with_rows_counter flag in such a case.

while here:
- change the semantic of Finder, now the select(...) method takes a morm::Select flags,
  and we have such flags:
  - Select::no_auto_generated_columns - do not generate columns from models
  - with_rows_counter - add an additional column for the rows counter
- remove Finder::prepare_to_select() - now use select(...) with no_auto_generated_columns flag
2022-07-11 17:48:13 +02:00
Tomasz Sowa 128f43482a make depend 2022-07-05 19:48:17 +02:00
Tomasz Sowa c89d4f76bc add global Makefile
src/Makefile uses now 'find' for looking for *.cpp files
and we don't need Makefile.o.dep anymore
2022-06-26 06:15:19 +02:00
Tomasz Sowa 89148de66d updated samples
- pikotools is in src subdirectory now
- map_fields() -> fields()
- prepare_table() -> table()
- instead of pt::MainSpaceParser we have pt::MainOptionsParser now
2021-06-24 21:14:29 +02:00
Tomasz Sowa 79fd642ef7 make depend 2021-04-09 17:50:23 +02:00
Tomasz Sowa fcf1d28b18 added FT class which is used in Model::field() methods
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
2021-03-10 16:20:11 +01:00
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 a5d5a81a57 removed: doc functionality (generating documentation from a model)
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
2019-09-18 15:55:42 +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 c133e949ce changed: SetFieldValueHelper -> FieldValueHelper
it's a much simpler structure now
removed: FieldValueBase and FieldValueContainer




git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1207 e52654a7-88a9-db11-a3e9-0013d4bc506e
2019-09-11 18:16:22 +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