add support for fetching values via GetFieldValue<T> #1910
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this requires
DbDataReader
, but in reality the reader is alwaysDbDataReader
; acknowledge this, and stop pretending to useIDataReader
internallyThe primary use for this is things like
SqlDecimal
which cannot be accessed other than viaDbDataReader.GetFieldValue<T>
or viaSqlDataReader.GetSqlDecimal
fix #1907
the most relevant parts are:
Query<SqlDecimal>
, the addition ofReadViaGetFieldValueFactory
which is a per-T cached factory method that works a lot like the old logic (now enshrined inReadViaGetValue
), but usingIsDbNull
andGetFieldValue<T>
LoadReaderValueViaGetFieldValue
, which reads a value in IL viaIsDbNull
andGetFieldValue<T>
; the use ofIsDbNull
means that we won't have anything to pop on the stack (unlike the old with did a read, dup, test, branch - leaving the original copy on the stack if we branched), which is tracked viapopWhenNull