Description
Problem statement
As CachingSession
manages preparation internally, it does not expose its PreparedStatement
s in any way. Therefore, it's not possible for a user of CachingSession
to call PreparedStatement::set_use_cached_result_metadata
in order to take advantage of that optimisation.
There are use cases when not having possibility to turn the optimisation on may result in significant inefficiency. As an example, the experimental NodeJS-over-Rust driver's API suits CachingSession
's API best, but lack of the mentioned optimisation makes the experimental driver fall short compared to the original NodeJS driver (which, most likely, has the optimisation turned on).
Possible solution
Expose a way to set up CachingSession
so that it turns the optimisation on for all PreparedStatement
s it manages.
Of course, write a big BEWARE
disclaimer mentioning what are the possible pitfalls when using the optimisation (SELECT *
, etc.).