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
This commit is contained in:
2022-07-11 17:48:13 +02:00
parent 4e8f3af8fc
commit 43dfbd5d5a
16 changed files with 512 additions and 179 deletions

View File

@@ -350,6 +350,8 @@ protected:
virtual void save_tree(bool save_whole_tree);
virtual void map_values_from_query();
virtual void map_additional_columns_from_query();
virtual void map_rows_counter_from_query();
virtual bool db_query(const char * raw_sql);
virtual bool db_query(const std::string & raw_sql);
@@ -1642,6 +1644,7 @@ protected:
template<typename ModelClass> friend class Finder;
template<typename ModelClass> friend class Cursor;
friend class BaseExpression;
friend class DbExpression;
friend class DbConnector;
friend class FlatConnector;