-
Notifications
You must be signed in to change notification settings - Fork 877
Handler rework #5123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Handler rework #5123
Changes from all commits
Commits
Show all changes
378 commits
Select commit
Hold shift + click to select a range
41a5e80
Add legacy datetime support
NinoFloris caed1f1
No unsupported resolver exceptions during introspection
NinoFloris 9defade
Fixes and a little lie about array types to appease the tests
NinoFloris 6f48fe4
Add money converter
NinoFloris 2d21c32
Add hstore converter
NinoFloris 68b8ef9
Improve range converter
NinoFloris 1784fc3
Rework buffer requirements
NinoFloris b16a601
Add json and jsonb textual reading/writing
NinoFloris 3739fdc
Naming
NinoFloris 1b1aedb
Implement NTS support
roji 033a042
Fix extension check
NinoFloris 594b2b8
Fix resolution
NinoFloris eeef6c8
Fix datatypename normalization from NpgsqlDbType
NinoFloris 4e7a9ef
Remove dead code
NinoFloris 5cdd9cc
Add arrays
roji 47212f3
More ns2.0 fixes again
NinoFloris e2b5327
Check binary size difference
NinoFloris ec36756
Move abstract up and impl down
NinoFloris 6bd7f38
Small fixes
NinoFloris 5a531f8
Fix datatable crap
NinoFloris c31af72
Add more text types
NinoFloris 934f11a
Multiranges
roji ec42026
Small fixes
NinoFloris dc649fe
Improve handling of sequential access cursor
NinoFloris 8f4c1e0
Bounded column reads
NinoFloris 4a1a5a3
Small fixes and TextReader support
NinoFloris 2620fcf
Final changes on bounded reads
NinoFloris dccde14
Implement GetChars over TextReader
NinoFloris 00b851a
Implement GetBytes
NinoFloris 42ef1da
More test fixes
NinoFloris e874e77
Handle cancellation retry in Read/ReadAsync buffer stream methods
NinoFloris 41b11e8
Netstandard fixes
NinoFloris 5ed5262
Another iteration of bounded reads, automatically consume data for co…
NinoFloris 1209ccc
Have nested data reader use nested reads as well
NinoFloris 0f0ceea
Improve nested reader invalidation mechanism
NinoFloris 7f6b349
Clarify rereading rules for sequential mode
NinoFloris aa7c6c1
Add back byte reading fast path
NinoFloris d382ff2
Implement ltree
roji 6f96239
Change removed property
NinoFloris d92391d
Colocate sync/async reading
NinoFloris bca19cb
Small fixes after doing a review
NinoFloris 1a87bb6
Complete some converter resolver todos
NinoFloris 762812e
Remove test for a mapping that doesn't exist
NinoFloris d0484e2
Add timestamp(tz) range mappings
NinoFloris bf6fdb3
Add back jagged validation
NinoFloris 17fdf8f
Breaking change, remove support for non generic list and derived List…
NinoFloris a3eb659
Add byte reading/writing of text and json
NinoFloris cf9857b
Remove roundtripping restrictions on certain bytea mappings
NinoFloris cd8a070
Add jsonpath support
NinoFloris 721353a
Revert an invalid optimization
NinoFloris f939f64
Add missed array mappings
NinoFloris 2140410
Add stream writing support to bytea
NinoFloris 9870761
Cache parameter size
NinoFloris 99523f5
Add multirange resolver
NinoFloris a1054c2
Small configurability additions to PgTypeInfo
NinoFloris d528029
Centralize type equality logic
NinoFloris 6f8c917
Stream fix
NinoFloris 460499c
Rationalize unboxing behavior, also opens up ability for arrays to be…
NinoFloris 50baaa5
Change array converters to constrain to IList
NinoFloris 51e4ae4
Add ts and tstzmultirange
NinoFloris 7cf537f
Allow null return from converter resolver
NinoFloris a30c75f
Create specialized versions for all the different datetime resolver k…
NinoFloris e1212ec
And remove the composing resolvers
NinoFloris 92cd1f0
Add accurate type names in datetime resolver exception
NinoFloris 86a7a5f
Don't lose stacktrace on break if possible
NinoFloris 8ed13f7
Add bitstring string writing
NinoFloris 167c6d7
Resolve aot warning
NinoFloris 24126f6
Handle a trim warning
NinoFloris 0309892
Suppress DbDataReader.GetFieldType dynamically accessed members attri…
NinoFloris 43c4eb8
Remove dead code, add comments and other small iterations
NinoFloris 3a15e89
Bring back default name translator
NinoFloris d15949a
Add unmapped enums
NinoFloris 0e89d7e
Add valuetuple and tuple records
NinoFloris 8d6c05b
Bring truncate behavior back as a compat feature
NinoFloris 00027fc
Rename method
NinoFloris 1c40a1a
Cleanup
NinoFloris 4c357d6
Package version bumps
NinoFloris f780b3b
Add STJ poco and known types support
NinoFloris 38a61c1
Revert nonsense
NinoFloris 43cd2c5
Fix typo
NinoFloris a15af2d
Improve introspection mode
NinoFloris 50442ef
Make nested writes consistent with reads
NinoFloris 874c407
Add composite type support
NinoFloris 0703f94
Netstandard fixes
NinoFloris edae3f8
Add STJ arrays
NinoFloris a0be4e5
Move field description info cache to reader
NinoFloris f08ecd5
Fixes
NinoFloris 1f16f5c
Add missed configure awaits
NinoFloris 5ecbfed
Make datatypename have an implicit conversion to string
NinoFloris 2960183
Fix nullable resolvers
NinoFloris 4bbb22c
Improve jsondocument sizing somewhat until unknown sizing support is …
NinoFloris 0763d02
Add GeoJSON support
NinoFloris 87ae2c8
Small improvement
NinoFloris 74065e6
Add Json.NET support
NinoFloris 51bdb4d
Add comment
NinoFloris 51f9304
Make PgConverterInfo and Bind internal
NinoFloris fd8e500
Implement boxed converter support in composites
NinoFloris d5b4a3e
Clean up PgTypeInfo api surface
NinoFloris bede1ec
Move delegating GetFieldValue calls to non-GVM GetFieldValueCore
NinoFloris 90a8411
Fix benchmark project errors
NinoFloris f412a2c
Properly respect async flag on nested read disposal (and ConfigureAwa…
NinoFloris 9c3deab
Remove an ensure overload
NinoFloris 90df4b4
Add back some friendly errors on missing pg types
NinoFloris 118ef5a
Fix cache bleed
NinoFloris e0fbf1f
Make type info cache code read better
NinoFloris b229db4
Make multirange mappings conditional on db support
NinoFloris 2031ac7
Actually revert AttemptPostgresCancellation and friends after dispose…
NinoFloris d6e078a
Catch race during extension create
NinoFloris b25dbf3
Assert null cache
NinoFloris 204b0d6
Remove dead reference
NinoFloris 0384260
Root out more invalid or missing reader state transitions
NinoFloris 93b2409
Fix writer ifdef issue
NinoFloris e0b9ea7
Fix double converter netstandard code
NinoFloris 1b751f4
Fix json type info resolver being null
NinoFloris 9338d48
Disable noda time tests for now
NinoFloris 82ca73b
Segregate tests simulating errors to prevent unrelated test from fail…
NinoFloris 43091df
Always reset read started
NinoFloris 3f1bc3b
Readability improvements
NinoFloris 5d5e98e
Centralize parameter info resets
NinoFloris 0e261e3
Only reset binding info for size changes
NinoFloris 5b19340
Improve PgTypeInfo api design
NinoFloris b6d8e3d
Try to prevent more multiplexing issues
NinoFloris 9a0c5b3
Go over some TODOs
NinoFloris 331f8e5
Add windows exemption to flaky test
NinoFloris 1d60e9f
Reduce jsonb text converter bloat
NinoFloris 043cd39
Rename
NinoFloris 23317d5
Shorten BufferData{Async} to Buffer{Async}
NinoFloris 85cca17
Improve nullable handling of sizes
NinoFloris bf7f339
Reduce the amount of types we reference
NinoFloris b6ac005
Create a dgml file to accompany the mstat
NinoFloris 18093a2
Reduce bloat
NinoFloris 87e8fa9
Small clarifications in abstractions
NinoFloris 45b9c26
Move ImmutableDictionary mapping for hstore to extra conversions
NinoFloris ca63186
And move BigInteger too
NinoFloris 47695e4
Properly remove all traces of ImmutableDictionary from hstore
NinoFloris 6c4c2fa
Only reference if not trimmed
NinoFloris 9d0c4fb
Fix typo
NinoFloris 17d007c
Move out of array and match name instead
NinoFloris 2fb590f
Typo
NinoFloris 77dc1ac
Bump sdk version to preview 7
NinoFloris 33cf9f0
Break away the last bits of PGUtil
NinoFloris 8fb498c
Remove unused namespaces
NinoFloris 3ccf9ab
Drop extension method
NinoFloris 77e6bb0
Make ValueMetadata readonly
NinoFloris cfef2c8
Fix todo
NinoFloris 217a922
Current fix
NinoFloris c457a19
Move unconsumed read error to endread
NinoFloris f56fe48
Sync binary exporter to patterns used in db data reader
NinoFloris e81d3b8
Enable all plugin tests and fix GeoJson errors
NinoFloris 0dd1ab8
Fix infinite range bug
NinoFloris 54488f4
Fix some exporter and replication value bugs
NinoFloris b82196a
Fix remaining nodatime plugin issues
NinoFloris 26ead6d
Restructure range resolver to be more priority based
NinoFloris 0745e8f
Add transaction for multiplexing to another test
NinoFloris 9e57073
Don't make json types default for reading
NinoFloris 204435b
Add net6.0 tfm to json.net to work around init prop issues
NinoFloris 14a46c8
Allow type predicates to deny default matches
NinoFloris 6d0de75
Fix remaining issues with Json.Net
NinoFloris cfbc1cb
Fix legacy infinite errors on NodaTime
NinoFloris f775827
Fix some incorrect null type predicate results
NinoFloris 8f67b47
Reflect removal of silly read default from STJ poco resolver
NinoFloris 03a8c18
Simplify infinity conversions again
NinoFloris 48af381
Check pg dimension bound during array write
NinoFloris 6b59118
Make range and multirange internal and add static factory instead
NinoFloris c5ec37b
Actually check length in all cases
NinoFloris 193a175
Fix returned multirange type
NinoFloris 288e57f
Normalize [] to _ in the constructor
NinoFloris d5d5d75
Fix compilation issue
NinoFloris b54be6a
Remove incorrect xmldoc
NinoFloris 0dc144e
Improve composite type info error message
NinoFloris b968616
Move out some classes
NinoFloris dea71d7
Rename
NinoFloris 71670e4
Speed up representational type resolution
NinoFloris 7d9caf2
Add missed representational type resolutions
NinoFloris d065dc1
Bring back dev build tfm for Json.Net
NinoFloris 0cf7c7e
Small naming and error message improvements
NinoFloris bae11dd
Make ColumnStream rely on cumulative position for consume during dispose
NinoFloris 716b9ec
Improve PgReader Init/Commit StartRead/EndRead code
NinoFloris a89f2b0
Remove _readStarted entirely now we have EndRead doing the consumed c…
NinoFloris 23a8eb9
More readability improvements
NinoFloris b93006b
Merge version byte prefixed text converter
NinoFloris c860836
Merge Hstore Read and ReadInto
NinoFloris 5286ddc
Move some exceptions to resources
NinoFloris 1e719af
Fast path other read bytes methods
NinoFloris 2b84085
Monomorphize byte array converter
NinoFloris aa1d35e
Streamline field read infra
NinoFloris 8c2c98a
Simplify cleanup
NinoFloris cfa7bfd
Fix boxing for default converters
NinoFloris 87de21f
Speed up GetInfo and GetFieldValueCore
NinoFloris 45aa8e0
Add info cache set and load for prepared statements
NinoFloris 2b0cfe3
Speed up reader start/stop init/commit
NinoFloris ef6c763
Speed up primitive reads
NinoFloris 0ca9eb7
Improve message
NinoFloris 966b93f
Remove unused fields
NinoFloris 68c0610
Small speedup
NinoFloris 802b1e0
Improve encapsulation of NpgsqlParameter
NinoFloris c6f7afd
More parameter streamlining
NinoFloris 5bedd08
Small readability improvements
NinoFloris 70b5b03
Improve MultiWriteState state clearing behavior
NinoFloris eaa3a4d
Centralize async helper read logic
NinoFloris 24eb65f
Add some missed buffer checks
NinoFloris 85229cd
Remove redundant code
NinoFloris 8d9719c
Map streaming onto SizeKind.Unknown instead of Size.Zero to make Buff…
NinoFloris bd2543a
Clarify bufferRequirements' applicability and fix nullable to adhere …
NinoFloris e607bef
Reader naming and structure improvements
NinoFloris 60cd814
Fix seek to column in GetFieldValueAsync
NinoFloris 8621153
Address nits
NinoFloris e9832ab
Make sure boxing infos use GetResolutionAsObject
NinoFloris 5db9e65
Rework parameter ValueType code
NinoFloris d5038e6
Reset type info on Value changes for typeof(object) generic parameters
NinoFloris 4f82171
Address more nits
NinoFloris 1d70d65
Upgrade to RC1
NinoFloris 8444895
Fix a default type fallback issue in the cache lookup
NinoFloris 0de762c
Add array type checks
roji 8e19205
Fix some more mappings and tests
NinoFloris 61a8f78
Fix the remaining array mapping issues
NinoFloris 4347682
Fix ensure issue and move PgWriter property to a method
NinoFloris 10e11be
Use full version
NinoFloris 97bf97a
Remove nightly feed
NinoFloris 097c478
Add pragma for new ref readonly warnings
NinoFloris 374c5d7
Fix nodatime array/multirange mapping tests
NinoFloris f77f484
Fix small bug in Json.NET synthetic mappings
NinoFloris 18a3fb2
Make multirange asserts conditional
NinoFloris 97d97bf
Fix debug build issues
NinoFloris 2bf2b48
Change PgReader 'not exactly consumed' exception and behavior
NinoFloris a5a14b7
Replace debug only exception
NinoFloris 32b4d75
Tidy up all dynamic mapping code
NinoFloris 13cb873
Implement unmapped ranges
NinoFloris 75cc6a1
Small tweaks
NinoFloris 7112c13
Don't rely on 'current' data inside GetBytes/GetData
NinoFloris 1950d0b
Fix SequentialAccess IsDbNull (resumable) + Get... (some non-resumabl…
NinoFloris db8a1db
Use DateTimeKind.Unspecified and assert on it in tests
NinoFloris c46c923
Address nits
NinoFloris 960ab27
Use new big endian support in Guid
NinoFloris 0810f5f
Add constants for states in BinaryExporter
NinoFloris 8d2a713
Add support for unmapped multiranges
NinoFloris 559a987
Don't try to get an object converter for type = null
NinoFloris 3eb5257
Rename TypeCatalog to DatabaseInfo
NinoFloris 07d05ba
Use IsAtStart in PgBufferedConverter
NinoFloris e02f40d
Add missed constant uses
NinoFloris a18e427
Actually implement IDisposable...
NinoFloris 945ad65
Address feedback
NinoFloris 9a4e731
Add resolvers check in GlobalTypeMapper (#15)
roji f244c63
Address feedback
NinoFloris 403bc15
Breaking change, move refcursor and jsonpath to DbType.Object
NinoFloris b81e7a4
Rework NotSupportedException back to InvalidCastException to align to…
NinoFloris 346386a
Make GetPostgresTypeXYZ/GetPgType overloads of GetPostgresType
NinoFloris f8fcd35
Message tweak
NinoFloris 7fd17f7
Improve GetConcreteResolution
NinoFloris 2841b54
Make jsonpath test conditional
NinoFloris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
|
|
||
| namespace Npgsql.GeoJSON; | ||
|
|
||
| /// <summary> | ||
| /// A map of entries that map the authority to the inclusive range of SRID. | ||
| /// </summary> | ||
| public partial class CrsMap | ||
| { | ||
| readonly CrsMapEntry[]? _overriden; | ||
|
|
||
| internal CrsMap(CrsMapEntry[]? overriden) | ||
| => _overriden = overriden; | ||
|
|
||
| internal string? GetAuthority(int srid) | ||
| => GetAuthority(_overriden, srid) ?? GetAuthority(WellKnown, srid); | ||
|
|
||
| static string? GetAuthority(CrsMapEntry[]? entries, int srid) | ||
| { | ||
| if (entries == null) | ||
| return null; | ||
|
|
||
| var left = 0; | ||
| var right = entries.Length; | ||
| while (left <= right) | ||
| { | ||
| var middle = left + (right - left) / 2; | ||
| var entry = entries[middle]; | ||
|
|
||
| if (srid < entry.MinSrid) | ||
| right = middle - 1; | ||
| else | ||
| if (srid > entry.MaxSrid) | ||
| left = middle + 1; | ||
| else | ||
| return entry.Authority; | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// An entry which maps the authority to the inclusive range of SRID. | ||
| /// </summary> | ||
| readonly struct CrsMapEntry | ||
| { | ||
| internal readonly int MinSrid; | ||
| internal readonly int MaxSrid; | ||
| internal readonly string? Authority; | ||
|
|
||
| internal CrsMapEntry(int minSrid, int maxSrid, string? authority) | ||
| { | ||
| MinSrid = minSrid; | ||
| MaxSrid = maxSrid; | ||
| Authority = authority != null | ||
| ? string.IsInterned(authority) ?? authority | ||
| : null; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| using System.Threading.Tasks; | ||
| using Npgsql.GeoJSON.Internal; | ||
|
|
||
| namespace Npgsql.GeoJSON; | ||
|
|
||
| /// <summary> | ||
| /// Extensions for getting a CrsMap from a database. | ||
| /// </summary> | ||
| public static class CrsMapExtensions | ||
| { | ||
| /// <summary> | ||
| /// Gets the full crs details from the database. | ||
| /// </summary> | ||
| /// <param name="dataSource"></param> | ||
| public static async Task<CrsMap> GetCrsMapAsync(this NpgsqlDataSource dataSource) | ||
| { | ||
| var builder = new CrsMapBuilder(); | ||
| using var cmd = GetCsrCommand(dataSource); | ||
| await using var reader = await cmd.ExecuteReaderAsync(); | ||
|
|
||
| while (await reader.ReadAsync()) | ||
| builder.Add(new CrsMapEntry(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2))); | ||
|
|
||
| return builder.Build(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the full crs details from the database. | ||
| /// </summary> | ||
| /// <param name="dataSource"></param> | ||
| public static CrsMap GetCrsMap(this NpgsqlDataSource dataSource) | ||
| { | ||
| var builder = new CrsMapBuilder(); | ||
| using var cmd = GetCsrCommand(dataSource); | ||
| using var reader = cmd.ExecuteReader(); | ||
|
|
||
| while (reader.Read()) | ||
| builder.Add(new CrsMapEntry(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2))); | ||
|
|
||
| return builder.Build(); | ||
| } | ||
|
|
||
| static NpgsqlCommand GetCsrCommand(NpgsqlDataSource dataSource) | ||
| => dataSource.CreateCommand(""" | ||
| SELECT min(srid), max(srid), auth_name | ||
| FROM(SELECT srid, auth_name, srid - rank() OVER(PARTITION BY auth_name ORDER BY srid) AS range FROM spatial_ref_sys) AS s | ||
| GROUP BY range, auth_name | ||
| ORDER BY 1; | ||
| """); | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put these as static Load() methods on CrsMap rather than as extensions of NpgsqlDataSource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly better yeah, though they do need a
usingat least