-
Couldn't load subscription status.
- Fork 81
Description
Using ORMs (e.g. hibernate), often you don't really control the batch sizes (depends on how much the ORM can reorder statements). For example, when inserting 2x2 rows, you can have
insert into A
insert into B
insert into A
insert into B
or
insert into A
insert into A
insert into B
insert into B
In the second case, the ORM may batch with prepared statements, in which case the query count from DataSourceQueryCountListener becomes 2 instead of 4. (NOTE: if the batch is with statement instead of preparedstatement, the count would still show as 4; but for preparedstatement it is 2)
having a count that doesn't depend on batch order allows to write robust tests when batch orders is non deterministic.
Something like this ?
Change
datasource-proxy/src/main/java/net/ttddyy/dsproxy/listener/DataSourceQueryCountListener.java
Line 75 in 74c1aa5
| count.increment(type); |
to
count.increment(type, queryInfo.getParametersList().size());?
NOTE: Maybe both counts are important (single count for multiple data prepared statement and also multiple count for multiple data prepared statement) so maybe there needs to be 2 different APIs/names for these counts ?