Skip to content

JSON Support : Investigate and update the conversion matrix used by smi and make sure that warning in the code is satisfied #2733

@apoorvdeshmukh

Description

@apoorvdeshmukh

Investigate and update the conversion matrix used by smi and make sure that this warning in the code is satisfied

private static bool CanAccessGetterDirectly(SmiMetaData metaData, ExtendedClrTypeCode setterTypeCode)
{
// Make sure no-one adds new ExtendedType, nor SqlDbType without updating this file!
Debug.Assert(ExtendedClrTypeCode.First == 0 && (int)ExtendedClrTypeCode.Last == s_canAccessGetterDirectly.GetLength(0) - 1, "ExtendedClrTypeCodes does not match with __canAccessGetterDirectly");
Debug.Assert(SqlDbType.BigInt == 0 && (int)SqlDbType.DateTimeOffset == s_canAccessGetterDirectly.GetLength(1) - 1, "SqlDbType does not match with __canAccessGetterDirectly");
Debug.Assert(ExtendedClrTypeCode.First <= setterTypeCode && ExtendedClrTypeCode.Last >= setterTypeCode);
Debug.Assert(SqlDbType.BigInt <= metaData.SqlDbType && SqlDbType.DateTimeOffset >= metaData.SqlDbType);

The CI runs on Release builds so the CI will not save you from violating assertions in this project.

You will probably need the sql server team to define the extensions to the conversion operations tables that start at

private static readonly bool[,] s_canAccessSetterDirectly = {

I suspect that json to binary might be the only conversion but someone needs to make that decision.

Originally posted by @Wraith2 in #2722 (comment)

Metadata

Metadata

Labels

Area\JsonUse this for issues that are targeted for the Json feature in the driver.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions