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

added support for max types for TVP #259

Merged
merged 5 commits into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4660,6 +4660,9 @@ void writeTVPRows(TVP value) throws SQLServerException {
case VARCHAR:
case NCHAR:
case NVARCHAR:
case LONGVARCHAR:
case LONGNVARCHAR:
case SQLXML:
isShortValue = (2L * columnPair.getValue().precision) <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
isNull = (null == currentColumnStringValue);
dataLength = isNull ? 0 : currentColumnStringValue.length() * 2;
Expand Down Expand Up @@ -4696,6 +4699,7 @@ else if (DataTypes.UNKNOWN_STREAM_LENGTH == dataLength)

case BINARY:
case VARBINARY:
case LONGVARBINARY:
// Handle conversions as done in other types.
isShortValue = columnPair.getValue().precision <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
isNull = (null == currentObject);
Expand Down Expand Up @@ -4835,6 +4839,9 @@ void writeTVPColumnMetaData(TVP value) throws SQLServerException {
case VARCHAR:
case NCHAR:
case NVARCHAR:
case LONGVARCHAR:
case LONGNVARCHAR:
case SQLXML:
writeByte(TDSType.NVARCHAR.byteValue());
isShortValue = (2L * pair.getValue().precision) <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
// Use PLP encoding on Yukon and later with long values
Expand All @@ -4854,6 +4861,7 @@ void writeTVPColumnMetaData(TVP value) throws SQLServerException {

case BINARY:
case VARBINARY:
case LONGVARBINARY:
writeByte(TDSType.BIGVARBINARY.byteValue());
isShortValue = pair.getValue().precision <= DataTypes.SHORT_VARTYPE_MAX_BYTES;
// Use PLP encoding on Yukon and later with long values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ else if (val instanceof OffsetTime)

case BINARY:
case VARBINARY:
case LONGVARBINARY:
bValueNull = (null == val);
nValueLen = bValueNull ? 0 : ((byte[]) val).length;

Expand All @@ -230,6 +231,9 @@ else if (val instanceof OffsetTime)
case VARCHAR:
case NCHAR:
case NVARCHAR:
case LONGVARCHAR:
case LONGNVARCHAR:
case SQLXML:
bValueNull = (null == val);
nValueLen = bValueNull ? 0 : (2 * ((String) val).length());

Expand Down
Loading