Skip to content

Commit

Permalink
Fix | Fix inserting large spatial datatypes (#1337)
Browse files Browse the repository at this point in the history
Fix inserting large spatial datatypes
  • Loading branch information
peterbae authored May 25, 2020
1 parent 1b52685 commit 4c26aff
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/Parameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,9 @@ void execute(DTV dtv, Boolean booleanValue) throws SQLServerException {
}

void execute(DTV dtv, byte[] byteArrayValue) throws SQLServerException {
if (null != byteArrayValue && byteArrayValue.length > DataTypes.SHORT_VARTYPE_MAX_BYTES)
// exclude JDBC typecasting for Geometry/Geography as these datatypes don't have a size limit.
if (null != byteArrayValue && byteArrayValue.length > DataTypes.SHORT_VARTYPE_MAX_BYTES
&& (dtv.getJdbcType() != JDBCType.GEOMETRY && dtv.getJdbcType() != JDBCType.GEOGRAPHY))
dtv.setJdbcType(dtv.getJdbcType().isBinary() ? JDBCType.LONGVARBINARY : JDBCType.LONGVARCHAR);

setTypeDefinition(dtv);
Expand Down
Loading

0 comments on commit 4c26aff

Please sign in to comment.