Skip to content

Commit 2208e61

Browse files
author
v-ahibr
authored
Merge pull request #259 from v-afrafi/TVP_LONGVARCHAR_types
added support for max types for TVP
2 parents 23371c7 + be47602 commit 2208e61

File tree

3 files changed

+537
-0
lines changed

3 files changed

+537
-0
lines changed

src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java

+8
Original file line numberDiff line numberDiff line change
@@ -4707,6 +4707,9 @@ void writeTVPRows(TVP value) throws SQLServerException {
47074707
case VARCHAR:
47084708
case NCHAR:
47094709
case NVARCHAR:
4710+
case LONGVARCHAR:
4711+
case LONGNVARCHAR:
4712+
case SQLXML:
47104713
isShortValue = (2L * columnPair.getValue().precision) <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
47114714
isNull = (null == currentColumnStringValue);
47124715
dataLength = isNull ? 0 : currentColumnStringValue.length() * 2;
@@ -4743,6 +4746,7 @@ else if (DataTypes.UNKNOWN_STREAM_LENGTH == dataLength)
47434746

47444747
case BINARY:
47454748
case VARBINARY:
4749+
case LONGVARBINARY:
47464750
// Handle conversions as done in other types.
47474751
isShortValue = columnPair.getValue().precision <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
47484752
isNull = (null == currentObject);
@@ -4912,6 +4916,9 @@ void writeTVPColumnMetaData(TVP value) throws SQLServerException {
49124916
case VARCHAR:
49134917
case NCHAR:
49144918
case NVARCHAR:
4919+
case LONGVARCHAR:
4920+
case LONGNVARCHAR:
4921+
case SQLXML:
49154922
writeByte(TDSType.NVARCHAR.byteValue());
49164923
isShortValue = (2L * pair.getValue().precision) <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
49174924
// Use PLP encoding on Yukon and later with long values
@@ -4931,6 +4938,7 @@ void writeTVPColumnMetaData(TVP value) throws SQLServerException {
49314938

49324939
case BINARY:
49334940
case VARBINARY:
4941+
case LONGVARBINARY:
49344942
writeByte(TDSType.BIGVARBINARY.byteValue());
49354943
isShortValue = pair.getValue().precision <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
49364944
// Use PLP encoding on Yukon and later with long values

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java

+4
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ else if (val instanceof OffsetTime)
213213

214214
case BINARY:
215215
case VARBINARY:
216+
case LONGVARBINARY:
216217
bValueNull = (null == val);
217218
nValueLen = bValueNull ? 0 : ((byte[]) val).length;
218219

@@ -230,6 +231,9 @@ else if (val instanceof OffsetTime)
230231
case VARCHAR:
231232
case NCHAR:
232233
case NVARCHAR:
234+
case LONGVARCHAR:
235+
case LONGNVARCHAR:
236+
case SQLXML:
233237
bValueNull = (null == val);
234238
nValueLen = bValueNull ? 0 : (2 * ((String) val).length());
235239

0 commit comments

Comments
 (0)