Commit Graph

177 Commits

Author SHA1 Message Date
Tomasz Sowa e46c090b41
fix: correctly serialize a Space class to the json format in the JSONExpression 2024-06-04 16:54:05 +02:00
Tomasz Sowa cd067ae5c3
add Model::field(...) methods with a pt::Stream argument 2024-06-04 10:24:05 +02:00
Tomasz Sowa 90b4d9af0b
use a char32_t character as a main character when converting strings
Use a char32_t instead of a wchar_t type. This is needed on systems
where sizeof(wchar_t) is equal to 2.
2024-06-01 00:17:01 +02:00
Tomasz Sowa 6fb7e29867
fix: correctly escape a pt::Stream in Finder from like() and similar methods
while here:
- in Finder: use pt::Stream and pt::TextStreamBase<> instead of pt::TextStream and pt::WTextStream
- add Finder::raw(...) methods with short int, int, long long and integer unsigned types
2024-05-31 00:31:30 +02:00
Tomasz Sowa 9a3f6a6e36
use pt::Stream instead of pt::TextStream as the output stream 2024-05-30 00:01:59 +02:00
Tomasz Sowa e026af9994
add QT Creator files to .gitignore 2023-10-22 23:37:44 +02:00
Tomasz Sowa 92d9d2c01b
add Finder::esc_like(...) methods 2023-10-10 19:43:02 +02:00
Tomasz Sowa 8200092524
add Finder::raw(pt::Date&,...) and esc(pt::Date &,...) methods 2023-07-17 03:42:14 +02:00
Tomasz Sowa 21f12a8a98
add support for declared cursors
Declare a cursor with the Finder::declare_cursor() method and next get the cursor with get_cursor():
morm::Cursor<MyObject> cursor = finder.
  raw("ORDER BY column_name ASC").

The cursor now can be used with fetch.*() methods and then get() or get_list():
MyObject myobject = cursor.fetch_next().get();
std::list<MyObject> myobjects = cursor.fetch_forward_count(10).get_list();
2023-07-16 04:03:03 +02:00
Tomasz Sowa 6619f3ecb5
fix: correctly use a table name when using Finder::use_table_prefix(true)
We cannot use aliases in the form of "tablename"."fieldname" - now it was
changed to "tablename.fieldname".

Sample how to get the id field, assuming the table name is 'mymodel'.
mymodel = finder2.
          raw("SELECT id AS \"\"").
          raw("FROM mymodel").
          raw("WHERE id = 25").

In addition, there was an error that the table name was not correctly set
for the first object in the hierarchy - it was empty, e.g. ""."field_name"
2023-07-15 03:08:02 +02:00
Tomasz Sowa e7c62e35dc
add Finder::is_null() and is_not_null() methods 2023-07-08 23:26:54 +02:00
Tomasz Sowa 25a91168ac
fix: correctly use a table name when a Select::no_auto_generated_columns flag is used 2023-05-08 10:26:31 +02:00
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 d61fc31b5c
allow to set a custom name for the auto generated rows counter column 2023-02-28 09:51:05 +01:00
Tomasz Sowa c56bae57ca
fix: propagate the model_data in the cursor
model_data can be used in Model::fields() method
2023-02-28 09:48:44 +01:00
Tomasz Sowa 1821c562f7
add a Select::distinct flag 2023-02-28 03:37:20 +01:00
Tomasz Sowa dee48ea2b5
use an <item> field when serializing a table to xml 2023-02-27 00:29:51 +01:00
Tomasz Sowa cf377204a9
improve the xml serializer
while here:
- do some refactoring in BaseExpression
2023-02-26 22:19:46 +01:00
Tomasz Sowa 0fbd988eda
serialize a model to flat string even when a DO_NOTHING_ON_SAVE flag is set
while here:
- add FT::serialize_to_null_if_null and FT::do_not_serialize_if_null flags
2023-02-26 18:28:16 +01:00
Tomasz Sowa d1c86c84cf fix: allow to use a minus sign in strings with FT::numeric flag 2023-01-11 23:06:27 +01:00
Tomasz Sowa 794051fa15 add basic support for serializing objects to xml 2022-12-16 02:48:07 +01:00
Tomasz Sowa a3c337355d fix: correctly read a date from a database if a date_only flag is set 2022-12-15 17:33:46 +01:00
Tomasz Sowa a4a1acebeb add Finder::like(...) and ilike(...) methods 2022-12-05 06:36:13 +01:00
Tomasz Sowa dfc631dd06 add more Finder::esc(...) and raw(...) methods 2022-12-02 13:26:30 +01:00
Tomasz Sowa 2ac8769d3a add Finder::esc(...) methods 2022-12-02 11:45:19 +01:00
Tomasz Sowa 7f4deaf847 update to the new pikotools api: change converting functions to the snake case 2022-11-14 03:38:27 +01:00
Tomasz Sowa 0ce05850b3 add FT::date_only, FT::time_only and FT::no_time_zone flags 2022-10-22 16:29:40 +02:00
Tomasz Sowa 38e790c2ac fix: correctly delete child objects - use the original value from save_mode 2022-08-17 07:43:58 +02:00
Tomasz Sowa bc92654be9 let Finder::page() takes a page number and not an offset 2022-08-04 14:54:04 +02:00
Tomasz Sowa c54a5bed05 add Model::get_logger() 2022-08-01 03:58:07 +02: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 4e8f3af8fc (finder): take pt::TextStream by const ref in raw(...) method 2022-07-08 22:02:02 +02:00
Tomasz Sowa 128f43482a make depend 2022-07-05 19:48:17 +02:00
Tomasz Sowa 3ddeb78c97 add LICENSE file 2022-07-03 11:01:14 +02:00
Tomasz Sowa ea6f9fd13e remove empty src/outstream.h file 2022-06-30 13:30:06 +02:00
Tomasz Sowa 1ad3d89d52 change headerfile_morm_* macros to headerfile_morm_src_* 2022-06-30 13:28:38 +02:00
Tomasz Sowa 576d537177 add src/version.h with macros: MORM_VERSION_MAJOR, MORM_VERSION_MINOR, MORM_VERSION_PATCH
Let the version be 0.7.0.
2022-06-30 13:19:55 +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 fc50c8ca5e fixed: in Finder::select(PT::TextStream & out_stream, ModelConnector & model_connector)
and Finder::select(PT::TextStream & out_stream, ModelConnector * model_connector)
       there was 'out_stream' parameter ignored

merged from 0890f27fe5
2022-06-25 18:30:53 +02:00
Tomasz Sowa 1ace47266d fix: correctly escape output stream buffer for models getters 2022-05-31 01:45:27 +02:00
Tomasz Sowa 21117e24c0 do Transaction::commit/rollback only on the same group for which a begin was called 2022-05-27 00:06:56 +02:00
Tomasz Sowa dd04ee84b7 capitalize INSERT/UPDATE/DELETE sql statements 2022-05-26 20:19:05 +02:00
Tomasz Sowa 1d4de8abe2 add support for nested transactions
while here:
- don't allow to copy/move DbConnector
2022-05-26 20:14:14 +02:00
Tomasz Sowa 907f10671d do not allow to copy/move transactions objects 2022-05-26 00:45:49 +02:00
Tomasz Sowa c5cf4a2672 add Transaction class as a wrapper for transactions 2022-05-26 00:34:17 +02:00
Tomasz Sowa b32917afe7 use pikotools Log::put_multiline() method when printing PostgreSQL error messages 2022-05-25 19:58:13 +02:00
Tomasz Sowa 0ce7578de3 fix: the way how we test if there is a connection issue
If there is a connection issue then PQexec returns a resultset now
- older versions of PostgreSQL returned null pointer.
2022-05-25 19:11:42 +02:00
Tomasz Sowa 12232bf722 propagate status from childs in Model::insert, Model::update, Model::remove and Model::save 2022-05-24 23:27:07 +02:00
Tomasz Sowa 1ad4cb4fbd trim white lines after PostgreSQL error message 2022-05-24 20:06:06 +02:00