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. 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();
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018-2022, Tomasz Sowa
|
||||
* Copyright (c) 2018-2023, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -144,6 +144,11 @@ bool DbConnector::query_remove(const char * query_str, QueryResult & query_resul
|
||||
return query(query_str, query_result);
|
||||
}
|
||||
|
||||
bool DbConnector::query_declare_cursor(const char * query_str, QueryResult & query_result)
|
||||
{
|
||||
return query(query_str, query_result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DbConnector::query_select(const pt::TextStream & stream, QueryResult & query_result)
|
||||
@@ -166,6 +171,12 @@ bool DbConnector::query_remove(const pt::TextStream & stream, QueryResult & quer
|
||||
return query(stream, query_result);
|
||||
}
|
||||
|
||||
bool DbConnector::query_declare_cursor(const pt::TextStream & stream, QueryResult & query_result)
|
||||
{
|
||||
return query(stream, query_result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DbConnector::begin()
|
||||
{
|
||||
@@ -910,4 +921,6 @@ const char * DbConnector::query_last_sequence(const wchar_t * sequence_table_nam
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user