diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java index 005951319f..244932c598 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java @@ -129,6 +129,7 @@ static class CityHash128Key implements java.io.Serializable { * Always refresh SerialVersionUID when prompted */ private static final long serialVersionUID = 166788428640603097L; + String unhashedString; private long[] segments; private int hashCode; @@ -138,6 +139,7 @@ static class CityHash128Key implements java.io.Serializable { } CityHash128Key(String s) { + unhashedString = s; byte[] bytes = new byte[s.length()]; s.getBytes(0, s.length(), bytes, 0); segments = CityHash.cityHash128(bytes, 0, bytes.length); @@ -147,7 +149,8 @@ public boolean equals(Object obj) { if (!(obj instanceof CityHash128Key)) return false; - return java.util.Arrays.equals(segments, ((CityHash128Key) obj).segments); + return (java.util.Arrays.equals(segments, ((CityHash128Key) obj).segments)//checks if hash is equal, short-circuitting; + && this.unhashedString.equals(((CityHash128Key) obj).unhashedString));//checks if string is equal } public int hashCode() { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java index e2dffc7479..8fb29a80c2 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java @@ -236,6 +236,7 @@ String getClassNameInternal() { userSQL = parsedSQL.processedSQL; userSQLParamPositions = parsedSQL.parameterPositions; initParams(userSQLParamPositions.length); + useBulkCopyForBatchInsert = conn.getUseBulkCopyForBatchInsert(); } /**