Globalization invariant mode: Require explicit LCID when constructing SqlMetaData#4457
Open
edwardneal wants to merge 1 commit into
Open
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4457 +/- ##
==========================================
- Coverage 65.83% 64.90% -0.93%
==========================================
Files 287 287
Lines 43763 66970 +23207
==========================================
+ Hits 28812 43469 +14657
- Misses 14951 23501 +8550
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
SqlClient doesn't currently support globalization invariant mode, and we throw an exception whenever someone tries to use it in the main SqlConnection entry point. This PR closes a similar entry point when instantiating the
SqlMetaDatatype.I've explicitly been specific when closing entry points, in order to leave the door open to future support for this mode. The main reason why we can't support it was the requirement for LCID/codepage mapping, but this was removed as a secondary effect of #4212.
The result of this PR is that if globalization invariant mode is enabled, only four SqlMetaData constructors are permitted for columns of type
Text/NText/Varchar/NVarchar/Char/NChar:SqlMetaData(string name, SqlDbType dbType, long maxLength, byte precision, byte scale, long locale, SqlCompareOptions compareOptions, Type userDefinedType)SqlMetaData(string name, SqlDbType dbType, long maxLength, byte precision, byte scale, long localeId, SqlCompareOptions compareOptions, Type userDefinedType, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)SqlMetaData(string name, SqlDbType dbType, long maxLength, long locale, SqlCompareOptions compareOptions, bool useServerDefault, bool isUniqueKey, SortOrder columnSortOrder, int sortOrdinal)SqlMetaData(string name, SqlDbType dbType, long maxLength, long locale, SqlCompareOptions compareOptions)These are permitted because they force the user to specify an LCID in the
localeor thelocaleIdparameter.Issues
Stands alone, but also lays the groundwork for #3742.
Testing
Unit tests have been added alongside the existing ones (which are, in turn, in the wrong assembly - to be cleaned up in a follow-up PR.)