jmoiron / sqlx

general purpose extensions to golang's database/sql
http://jmoiron.github.io/sqlx/
MIT License
16.32k stars 1.09k forks source link

Invalidate cache on Rows.NextResultSet call #858

Open kamilkoduo opened 1 year ago

kamilkoduo commented 1 year ago

When reading multiple result sets from sqlx.Rows using StructScan, some information obtained usCCCing costly reflect operations is cached for performance optimisation. However, different result sets in a single sqlx.Rows object might have different structures, so cache should be invalidated and rebuild after each NextResultSet call. Now this method is not overwritten, so old cache interferes with new structures after first result set scan.

Relates #857

cornelk commented 1 year ago

Thanks for the fix! There is another PR open for this issue: https://github.com/jmoiron/sqlx/pull/747 which includes a unit test.

@jmoiron any chance to get this or the other fix merged?

batazor commented 1 year ago

@jmoiron Yeah, that's a real problem, it would be cool if you could merge one of these solutions

tazimmerman commented 1 year ago

@jmoiron Are you open to additional maintainers? There are a handful of really useful PRs that look straightforward and I'd be happy to help get them merged. This is a fantastic project and given its widespread use, keeping future changes in the original repo would be ideal.

dlsniper commented 9 months ago

Hello, @ardan-bkennedy, and I recently stepped in to help maintain this project. We are currently evaluating all the opened PRs. We'll take a look at this shortly and see if this, #747 or another, will be a good solution for this problem.