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

Adding the SqlJson type #2734

Closed
wants to merge 2 commits into from
Closed

Conversation

saurabh500
Copy link
Contributor

Fixes #2665

Brings in the SqlJson implementation along with the tests.

The ref will be updated #2670 closer to the release.

Remove unused

Adding all the json tests

Revert "Remove unused"

This reverts commit c448b6e.

Remove unused
@saurabh500
Copy link
Contributor Author

This PR cannot be merged, since the tests which work with package reference would fail to compile.
We will merge this in, when we start to modify the ref assemblies on the main branch, which will make sense after the TDS protocol is documented.

Comment on lines +82 to +94
{
get
{
if (IsNull)
{
throw new SqlNullValueException();
}
else
{
return _jsonString!;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: if you want to start using more modern C# code, this can be a simple expression-bodied method with a conditional operator:

Suggested change
{
get
{
if (IsNull)
{
throw new SqlNullValueException();
}
else
{
return _jsonString!;
}
}
}
=> IsNull ? throw new SqlNullValueException() : _jsonString!;

_isNull = true;
}

private static void ValidateJson(string jsonString)
Copy link
Member

Choose a reason for hiding this comment

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

Is this additional parsing of the entire document necessary (with the associated perf overhead)? I'm assuming that SQL Server would throw anyway on any bad input etc...

@cheenamalhotra
Copy link
Member

Do we still need this PR?
@saurabh500 @apoorvdeshmukh @deepaksa1

@deepaksa1
Copy link
Contributor

Do we still need this PR? @saurabh500 @apoorvdeshmukh @deepaksa1

We have already merged the SqlJson class in a separate PR. I think this one can be dropped

@apoorvdeshmukh
Copy link
Contributor

apoorvdeshmukh commented Oct 7, 2024 via email

@saurabh500 saurabh500 deleted the dev/sqljson branch October 7, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API Proposal: SqlJson class design to support JSON datatype
5 participants