Hi,
We are looking the right way to create one SelectQuery from another
SelectQuery ("count query" from "select query").
Here is our use cases.
1. We have operation that executes select query and do pagination logic.
public static <T> SearchResult<T> executeSearch(Class<? extends T>
clazz, SearchParameters params,
SelectQuery
selectQuery, SelectQuery countQuery);
SearchParameters contains required page number, filter and sort order.
SearchResult contains list of entities (page) and number of elements (total
number of rows).
executeSearch sets limit clause, adds conditions, executes query.
In order to count total number of rows we use countQuery.
countQuery is very simular to selectQuery. It would be nice to create it
from selectQuery (the same from, where, connect by clauses), but without
order by.
It's not clear how to extract configuration, "from" and "where" clauses
from SelectQuery (using jOOQ API, w/o reflection).
SelectQueryImpl is package visible and it contains package visible
attachments..
2. We receive selectQuery in executeSearch operation ("select field1,
field2, field3 ... from table ..") and want to exclude some fields from
field set. Now selectQuery.getSelect() returns modifiable list of fields
and we can add/remove elements. However we are not sure, that this
collection will be modifiable in the future.
--
Best regards,
Sergey