Skip to content
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

Update SQL Server type mappings for strings #19428

Merged
merged 1 commit into from
Dec 30, 2019
Merged

Conversation

ajcvickers
Copy link
Member

Fixes #19327

Create fixed-length type mappings by default, and then use the correct DbType in the parameter if the length of the value matches the parameter length. This has a better chance of hitting an index. In other cases, change the DbType to match what we did before so that SQLClient doesn't truncate or pad.

Fixes #14555

If the parameter value length is greater than the max length but less than the max bounded length, then using the max bounded length rather than going immediately to unbounded.

@ajcvickers ajcvickers changed the base branch from HaloFiveToHaloSix1227 to master December 30, 2019 20:19
@ajcvickers ajcvickers closed this Dec 30, 2019
@ajcvickers ajcvickers reopened this Dec 30, 2019
Copy link
Member

@AndriySvyryd AndriySvyryd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a benchmark with string parameters of varying lengths.

@ajcvickers
Copy link
Member Author

@AndriySvyryd Filed #19429

Fixes #19327

Create fixed-length type mappings by default, and then use the correct DbType in the parameter if the length of the value matches the parameter length. This has a better chance of hitting an index. In other cases, change the DbType to match what we did before so that SQLClient doesn't truncate or pad.

Fixes #14555

If the parameter value length is greater than the max length but less than the max bounded length, then using the max bounded length rather than going immediately to unbounded.
@ajcvickers ajcvickers merged commit 4d76b89 into master Dec 30, 2019
@ajcvickers ajcvickers deleted the GetItRightMrBrown1230 branch December 30, 2019 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants