Declare a cursor with the Finder::declare_cursor() method and next get the cursor with get_cursor():
morm::Cursor<MyObject> cursor = finder.
declare_cursor("mycursorname").
select().
raw("ORDER BY column_name ASC").
get_cursor();
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();
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.
select(morm::Select::no_auto_generated_columns).
use_table_prefix(true).
raw("SELECT id AS \"mymodel.id\"").
raw("FROM mymodel").
raw("WHERE id = 25").
get();
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"
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
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
Char type was converted to wchar_t and then was serialized as utf-8 stream.
Let char type will always be one char, of course it need to be a valid utf-8 sequence.
Let FT::dont_use_utf8 apply only to wchar_t and std::wstring
but ignore it if FT::hexadecimal or FT::binary are defined.
Now we have bool BaseExpression::esc_char(wchar_t val, pt::TextStream & stream) method
which (in most cases) will be used in derived classes.
Let wchar_t (and std::wstring) will be stored as 8 hex digits when using FT::hexadecimal
or FT::binary (and ignore FT::dont_use_utf8 in such a case).