sqlx
sqlx copied to clipboard
adds support for structscan in multiple resultset queries
StructScan fails in a multiple result set scenario when the result sets have different row layouts.
Currently sqlx is unaware of iteration over multiple result sets and uses the first call to StructScan to set a field cache for performance reasons. When a next result set is iterated over, this field cache will most likely not match the struct provided.
By wrapping the NextResultSet method from sql.Rows and setting the field cache started
property back to false the problem is solved.
Pull Request Test Coverage Report for Build 101
- 3 of 5 (60.0%) changed or added relevant lines in 1 file are covered.
- 240 unchanged lines in 5 files lost coverage.
- Overall coverage decreased (-4.7%) to 67.144%
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
---|---|---|---|
sqlx.go | 3 | 5 | 60.0% |
<!-- | Total: | 3 | 5 |
Files with Coverage Reduction | New Missed Lines | % |
---|---|---|
bind.go | 20 | 77.7% |
sqlx_context.go | 24 | 58.64% |
named.go | 44 | 78.4% |
sqlx.go | 72 | 63.45% |
reflectx/reflect.go | 80 | 66.54% |
<!-- | Total: | 240 |
Totals | |
---|---|
Change from base Build 32: | -4.7% |
Covered Lines: | 985 |
Relevant Lines: | 1467 |
💛 - Coveralls
@jmoiron friendly ping. any feedback?
@jmoiron is there a way forward on merging this PR? This fixes a critical issue for, what to me is, a common use case.
FYI; we've started using this branch @basvanbeek works great 👍
Hello, @ardan-bkennedy, and I recently stepped in to help maintain this project. We are sorting the opened issues and I think this can be closed in favor of #747. Thank you for your contribution.