Skip to content

Commit 2fe4afa

Browse files
authored
Enhancing the SqlDbType with Json (#103985)
Closes #103925
1 parent 0d426df commit 2fe4afa

File tree

2 files changed

+148
-2
lines changed

2 files changed

+148
-2
lines changed

src/libraries/System.Data.Common/ref/System.Data.Common.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,7 @@ public enum SqlDbType
16561656
Time = 32,
16571657
DateTime2 = 33,
16581658
DateTimeOffset = 34,
1659+
Json = 35,
16591660
}
16601661
public sealed partial class StateChangeEventArgs : System.EventArgs
16611662
{

src/libraries/System.Data.Common/src/System/Data/SqlDbType.cs

Lines changed: 147 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,185 @@
33

44
namespace System.Data
55
{
6-
// Specifies the SQL Server data type.
6+
/// <summary>
7+
/// Specifies SQL Server-specific data type of a field, property, for use in a <see cref="T:Microsoft.Data.SqlClient.SqlParameter" />.
8+
/// </summary>
79
public enum SqlDbType
810
{
9-
// A 64-bit signed integer.
11+
/// <summary>
12+
/// <see cref="long" />. A 64-bit signed integer.
13+
/// </summary>
1014
BigInt = 0,
15+
16+
/// <summary>
17+
/// <see cref="Array"/> of type <see cref="byte"/>. A fixed-length stream of binary data ranging between 1 and 8,000 bytes.
18+
/// </summary>
1119
Binary = 1,
20+
21+
/// <summary>
22+
/// <see cref="bool"/>. An unsigned numeric value that can be 0, 1, or <see langword="null"/>
23+
/// </summary>
1224
Bit = 2,
25+
26+
/// <summary>
27+
/// <see cref="string"/>. A fixed-length stream of non-Unicode characters ranging between 1 and 8,000 characters.
28+
/// </summary>
1329
Char = 3,
30+
31+
/// <summary>
32+
/// <see cref="System.DateTime"/>. Date and time data ranging in value from January 1, 1753 to December 31, 9999 to an accuracy of 3.33 milliseconds
33+
/// </summary>
1434
DateTime = 4,
35+
36+
/// <summary>
37+
/// <see cref="decimal"/>. A fixed precision and scale numeric value between -10 <sup>38</sup> -1 and 10 <sup>38</sup> -1.
38+
/// </summary>
1539
Decimal = 5,
40+
41+
/// <summary>
42+
/// <see cref="double"/>. A floating point number within the range of -1.79E +308 through 1.79E +308.
43+
/// </summary>
1644
Float = 6,
45+
46+
/// <summary>
47+
/// <see cref="Array"/> of type <see cref="byte"/>. A variable-length stream of binary data ranging from 0 to 2 <sup>31</sup> -1
48+
/// (or 2,147,483,647) bytes.
49+
/// </summary>
1750
Image = 7,
51+
52+
/// <summary>
53+
/// <see cref="int"/>. A 32-bit signed integer.
54+
/// </summary>
1855
Int = 8,
56+
57+
/// <summary>
58+
/// <see cref="decimal"/>. A currency value ranging from -2 <sup>63</sup> (or -9,223,372,036,854,775,808) to 2 <sup>63</sup>
59+
/// -1 (or +9,223,372,036,854,775,807) with an accuracy to a ten-thousandth of a currency unit.
60+
/// </summary>
1961
Money = 9,
62+
63+
/// <summary>
64+
/// <see cref="string"/>. A fixed-length stream of Unicode characters ranging between 1 and 4,000 characters.
65+
/// </summary>
2066
NChar = 10,
67+
68+
/// <summary>
69+
/// <see cref="string"/>. A variable-length stream of Unicode data with a maximum length of 2 <sup>30</sup> - 1
70+
/// (or 1,073,741,823) characters.
71+
/// </summary>
2172
NText = 11,
73+
74+
/// <summary>
75+
/// <see cref="string"/>. A variable-length stream of Unicode characters ranging between 1 and 4,000 characters. Implicit
76+
/// conversion fails if the string is greater than 4,000 characters. Explicitly set the object when working with strings
77+
/// longer than 4,000 characters. Use <see cref="F:System.Data.SqlDbType.NVarChar"/> when the database column is
78+
/// <see langword="nvarchar(max)"/>.
79+
/// </summary>
2280
NVarChar = 12,
81+
82+
/// <summary>
83+
/// <see cref="float"/>. A floating point number within the range of -3.40E +38 through 3.40E +38.
84+
/// </summary>
2385
Real = 13,
86+
87+
/// <summary>
88+
/// <see cref="Guid"/>. A globally unique identifier (or GUID).
89+
/// </summary>
2490
UniqueIdentifier = 14,
91+
92+
/// <summary>
93+
/// <see cref="System.DateTime"/>. Date and time data ranging in value from January 1, 1900 to June 6, 2079 to an accuracy of one minute.
94+
/// </summary>
2595
SmallDateTime = 15,
96+
97+
/// <summary>
98+
/// <see cref="short"/>. A 16-bit signed integer.
99+
/// </summary>
26100
SmallInt = 16,
101+
102+
/// <summary>
103+
/// <see cref="decimal"/>. A currency value ranging from -214,748.3648 to +214,748.3647 with an accuracy to a ten-thousandth of a currency unit.
104+
/// </summary>
27105
SmallMoney = 17,
106+
107+
/// <summary>
108+
/// <see cref="string"/>. A variable-length stream of non-Unicode data with a maximum length of 2 <sup>31</sup> -1 (or 2,147,483,647) characters.
109+
/// </summary>
28110
Text = 18,
111+
112+
/// <summary>
113+
/// <see cref="System.Array"/> of type <see cref="byte"/>. Automatically generated binary numbers, which are guaranteed to be unique within a database. <see langword="timestamp"/> is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes.
114+
/// </summary>
29115
Timestamp = 19,
116+
117+
/// <summary>
118+
/// <see cref="byte"/>. An 8-bit unsigned integer.
119+
/// </summary>
30120
TinyInt = 20,
121+
122+
/// <summary>
123+
/// <see cref="System.Array"/> of type <see cref="byte"/>. A variable-length stream of binary data ranging between 1 and 8,000 bytes.
124+
/// Implicit conversion fails if the byte array is greater than 8,000 bytes. Explicitly set the object when working with byte arrays
125+
/// larger than 8,000 bytes.
126+
/// </summary>
31127
VarBinary = 21,
128+
129+
/// <summary>
130+
/// <see cref="string"/>. A variable-length stream of non-Unicode characters ranging between 1 and 8,000 characters.
131+
/// Use <see cref="F:System.Data.SqlDbType.VarChar"/> when the database column is <see langword="varchar(max)"/>.
132+
/// </summary>
32133
VarChar = 22,
134+
135+
/// <summary>
136+
/// <see cref="object"/>. A special data type that can contain numeric, string, binary, or date data as well as the SQL Server values Empty and Null,
137+
/// which is assumed if no other type is declared.
138+
/// </summary>
33139
Variant = 23,
140+
141+
/// <summary>
142+
/// An XML value. Obtain the XML as a string using the <see cref="M:Microsoft.Data.SqlClient.SqlDataReader.GetValue(System.Int32)"/> method or
143+
/// <see cref="P:System.Data.SqlTypes.SqlXml.Value"/> property, or as an <see cref="T:System.Xml.XmlReader"/> by calling the
144+
/// <see cref="M:System.Data.SqlTypes.SqlXml.CreateReader"/> method.
145+
/// </summary>
34146
Xml = 25,
147+
148+
/// <summary>
149+
/// A SQL Server user-defined type (UDT).
150+
/// </summary>
35151
Udt = 29,
152+
153+
/// <summary>
154+
/// A special data type for specifying structured data contained in table-valued parameters.
155+
/// </summary>
36156
Structured = 30,
157+
158+
/// <summary>
159+
/// Date data ranging in value from January 1,1 AD through December 31, 9999 AD.
160+
/// </summary>
37161
Date = 31,
162+
163+
/// <summary>
164+
/// Time data based on a 24-hour clock. Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds.
165+
/// Corresponds to a SQL Server <see langword="time"/> value.
166+
/// </summary>
38167
Time = 32,
168+
169+
/// <summary>
170+
/// Date and time data. Date value range is from January 1,1 AD through December 31, 9999 AD.
171+
/// Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds.
172+
/// </summary>
39173
DateTime2 = 33,
174+
175+
/// <summary>
176+
/// Date and time data with time zone awareness. Date value range is from January 1,1 AD through December 31, 9999 AD.
177+
/// Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds. Time zone value range
178+
/// is -14:00 through +14:00.
179+
/// </summary>
40180
DateTimeOffset = 34,
181+
182+
/// <summary>
183+
/// A JSON value.
184+
/// </summary>
185+
Json = 35,
41186
}
42187
}

0 commit comments

Comments
 (0)