You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataSourceQueryCountListener may or may not be appropriate because it is an accumulated number by thread or global, based on the strategy.
This means, if it is thread based, the count for the ResultSet#next becomes a total of all the ResultSet reads for the thread(usually typical request-response lifecycle in servlet). So, if one request-response makes 3 select queries and each reads 10 records, the QueryCount will have count=30. I think what people more interested is a read count for each query.
The manual way of achieving this is by implementing MethodExecutionListener and reacting on the callback of ResultSet#next.
A drawback of this approach is that you need to manage the lifecycle of ResultSet open/close and associate the count to the resultset.
I think the best approach to the library is to add a callback specific to the ResultSet lifecycle.
For example, every time next is called, trigger a callback with a value that contains how many times it is called for the specific ResultSet. (actually, r2dbc-proxy has this callback.)
Also, need a callback when ResultSet#close is called to receive the total count for the next. A thing that makes it more interesting is that calling ResultSet#close is an optional operation that Statement#close implies the close of the ResultSet.
(Just a memo to myself about what needs to be done to achieve this)
I'd like to test the number of returned rows from some JPA select queries. Would it be possible to add that to net.ttddyy.dsproxy.QueryCount?
The text was updated successfully, but these errors were encountered: