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

Update master with latest changes #793

Merged
merged 35 commits into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3cd3a6a
Update Snapshot for upcoming RTW release v7.0.0
cheenamalhotra Jul 3, 2018
465018b
Merge pull request #735 from cheenamalhotra/update-snapshot
cheenamalhotra Jul 3, 2018
7fa7fa6
Change order of logic for checking the condition for using Bulk Copy …
peterbae Jul 4, 2018
38cddc6
Update CHANGELOG.md
cheenamalhotra Jul 5, 2018
7243eb5
Merge pull request #732 from cheenamalhotra/module (Export driver in …
cheenamalhotra Jul 6, 2018
9dec753
Update CHANGELOG.md
cheenamalhotra Jul 9, 2018
e2cf217
Change Sha1HashKey to CityHash128Key for generating PreparedStatement…
cheenamalhotra Jul 9, 2018
78c6a19
Add | Adding useBulkCopyForBatchInsert property to Request Boundary m…
ulvii Jul 9, 2018
c4b6e64
Apply the collation name change to UTF8SupportTest
ulvii Jul 9, 2018
ba62623
Package changes for CityHash with license information (#740)
cheenamalhotra Jul 10, 2018
eea5de2
Reformatted Code + Updated formatter (#742)
cheenamalhotra Jul 11, 2018
594e413
Fix policheck issue with 'Country' keyword (#745)
cheenamalhotra Jul 11, 2018
521e6b3
Adding a new test for beginRequest()/endRequest() (#746)
ulvii Jul 12, 2018
9e697a5
Fix | Fixes for issues reported by static analysis tools (SonarQube +…
rene-ye Jul 12, 2018
11e2bf4
handle buffer reading
rene-ye Jul 19, 2018
0fef350
Revert "handle buffer reading"
rene-ye Jul 19, 2018
2d0f906
updated javadocs (#754)
lilgreenbird Jul 25, 2018
07641b0
fixed some typos in javadocs (#760)
lilgreenbird Jul 25, 2018
aa0f653
API and JavaDoc changes for Spatial Datatypes (#752)
peterbae Jul 27, 2018
ca4558e
Disallow non-parameterized queries for Bulk Copy API for batch insert…
peterbae Jul 28, 2018
970f21a
Formatting | Change scope of unwanted Public APIs + Code Format (#757)
cheenamalhotra Jul 28, 2018
3bef06c
Release | Release 7.0 changelog and version update (#748)
cheenamalhotra Jul 28, 2018
07553db
Update Samples and add new samples for new features (#761)
cheenamalhotra Jul 31, 2018
c678352
Update License copyright (#767)
cheenamalhotra Jul 31, 2018
e301555
Update snapshot for next release (#768)
cheenamalhotra Aug 1, 2018
49ede82
Version Updates | Update Junit test Maven dependencies (#777)
cheenamalhotra Aug 14, 2018
fad697f
Fix | Random Junit failures in framework tests (#762)
cheenamalhotra Aug 17, 2018
ddc1d94
Degradation fix for column encryption enabled (AE) (#773)
rene-ye Aug 17, 2018
2c86309
Improvement | Improve performance of readLong function unrolling loop…
robertonr Aug 17, 2018
f415394
New API | Add support for LocalDate, LocalTime and LocalDateTime to b…
gordthompson Aug 18, 2018
5c20b4e
Fix | Fix JavaDoc warnings and remove obselete HTML tags (#786)
cheenamalhotra Aug 24, 2018
6580dee
Fix | Changes to read SQL Warnings after ResultSet is read completely…
cheenamalhotra Aug 25, 2018
cdd4b80
Updating the issue template (#779)
ulvii Aug 28, 2018
b7e0e31
Update changelog for v7.1.0 preview release (#789)
cheenamalhotra Aug 29, 2018
82f4a1c
Merge branch 'up-master' into ms-dev
cheenamalhotra Aug 29, 2018
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)

## [7.1.0] Preview Release
### Added
- Added support for LocalDate, LocalTime and LocalDateTime to be passed as 'type' in ResultSet.getObject() [#749](https://github.com/Microsoft/mssql-jdbc/pull/749)
- Added support to read SQL Warnings after ResultSet is read completely [#785](https://github.com/Microsoft/mssql-jdbc/pull/785)

### Fixed Issues
- Fixed Javadoc warnings and removed obselete HTML tags from Javadocs [#786](https://github.com/Microsoft/mssql-jdbc/pull/786)
- Fixed random JUnit failures in framework tests [#762](https://github.com/Microsoft/mssql-jdbc/pull/762)

### Changed
- Improved performance of readLong() function by unrolling loop and using bitwise operators instead of additions [#763](https://github.com/Microsoft/mssql-jdbc/pull/763)
- Removed logging logic which caused performance degradation in AE [#773](https://github.com/Microsoft/mssql-jdbc/pull/773)

## [7.0.0] Stable Release
### Added
- Added 'Automatic-Module-Name' manifest entry to jre10 Jar, allowing JDK 10 users to access driver module 'com.microsoft.sqlserver.jdbc' [#732](https://github.com/Microsoft/mssql-jdbc/pull/732)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ To get the latest preview version of the driver, add the following to your POM f
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.5.4.jre10-preview</version>
<version>7.1.0.jre10-preview</version>
</dependency>
```
### Using driver as Java Module
Expand Down Expand Up @@ -119,7 +119,7 @@ Projects that require either of the two features need to explicitly declare the
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.0.0.jre10</version>
<version>7.1.0.jre10-preview</version>
<scope>compile</scope>
</dependency>

Expand All @@ -135,7 +135,7 @@ Projects that require either of the two features need to explicitly declare the
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.0.0.jre10</version>
<version>7.1.0.jre10-preview</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -183,7 +183,7 @@ Preview releases happen approximately monthly between stable releases. This give
You can see what is going into a future release by monitoring [Milestones](https://github.com/Microsoft/mssql-jdbc/milestones) in the repository.

### Versioning convention
Starting with 6.0, stable versions have an even minor version. For example, 6.0, 6.2, 6.4. Preview versions have an odd minor version. For example, 6.1, 6.3, 6.5.
Starting with 6.0, stable versions have an even minor version. For example, 6.0, 6.2, 6.4, 7.0. Preview versions have an odd minor version. For example, 6.1, 6.3, 6.5, 7.1.

## Contributors
Special thanks to everyone who has contributed to the project.
Expand Down
15 changes: 7 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

apply plugin: 'java'

version = '7.0.0'
version = '7.1.0'
def jreVersion = ""
def testOutputDir = file("build/classes/java/test")
def archivesBaseName = 'mssql-jdbc'
Expand All @@ -27,7 +27,7 @@ allprojects {

if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile == "build43")){

jreVersion = "jre10"
jreVersion = "jre10-preview"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
jar {
manifest {
Expand All @@ -40,7 +40,7 @@ if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile

if((hasProperty('buildProfile') && buildProfile == "build42")) {

jreVersion = "jre8"
jreVersion = "jre8-preview"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc43.java'

sourceCompatibility = 1.8
Expand Down Expand Up @@ -84,15 +84,14 @@ repositories {
dependencies {
compileOnly 'com.microsoft.azure:azure-keyvault:1.0.0',
'com.microsoft.azure:adal4j:1.6.0'
testCompile 'junit:junit:4.12',
'org.junit.platform:junit-platform-console:1.2.0',
testCompile 'org.junit.platform:junit-platform-console:1.2.0',
'org.junit.platform:junit-platform-commons:1.2.0',
'org.junit.platform:junit-platform-engine:1.2.0',
'org.junit.platform:junit-platform-launcher:1.2.0',
'org.junit.platform:junit-platform-runner:1.2.0',
'org.junit.platform:junit-platform-surefire-provider:1.2.0',
'org.junit.jupiter:junit-jupiter-api:5.2.0',
'org.junit.jupiter:junit-jupiter-engine:5.2.0',
'com.zaxxer:HikariCP:3.1.0',
'org.apache.commons:commons-dbcp2:2.0'
}
'com.zaxxer:HikariCP:3.2.0',
'org.apache.commons:commons-dbcp2:5.0'
}
50 changes: 27 additions & 23 deletions issue_template.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
## Driver version or jar name
Please tell us what the JDBC driver version or jar name is.

## SQL Server version
Please tell us what the SQL Server version is.

## Client operating system
Please tell us what oprating system the client program is running on.

## Java/JVM version
Example: java version "1.8.0", IBM J9 VM

## Table schema
Please tell us the table schema

## Problem description
Please share more details with us.

## Expected behavior and actual behavior
Please tell us what should happen and what happened instead

## Repro code
Please share repro code with us, or tell us how to reproduce the issue.
## Driver version
<!--- Provide the JDBC driver version (e.g. 7.0.0). -->

## SQL Server version
<!--- Provide the output of executing `SELECT @@VERSION` on your target SQL Server. -->

## Client Operating System
<!--- Provide the Operating System the client application is running on. -->

## JAVA/JVM version
<!--- Provide the JAVA/JVM version (e.g. java version "1.8.0", IBM J9 VM). -->

## Table schema
<!--- Provide the table schema. -->

## Problem description
<!--- Provide full details of the problem. -->
1. Expected behaviour:
2. Actual behaviour:
3. Error message/stack trace:
4. Any other details that can be helpful:

## JDBC trace logs
<!--- Provide the JDBC trace logs. Instructions can be found here: https://docs.microsoft.com/en-us/sql/connect/jdbc/tracing-driver-operation?view=sql-server-2017 -->

## Reproduction code
<!--- Provide standalone JAVA code that reproduces the issue, preferably raw JDBC code. -->
16 changes: 5 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
<packaging>jar</packaging>

<name>Microsoft JDBC Driver for SQL Server</name>
Expand Down Expand Up @@ -59,12 +59,6 @@
</dependency>

<!-- dependencies for running tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-console</artifactId>
Expand Down Expand Up @@ -116,13 +110,13 @@
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2 </artifactId>
<version>2.2.0</version>
<version>2.5.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -131,7 +125,7 @@
<profile>
<id>build42</id>
<build>
<finalName>${project.artifactId}-${project.version}.jre8</finalName>
<finalName>${project.artifactId}-${project.version}.jre8-preview</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down Expand Up @@ -164,7 +158,7 @@
<activeByDefault>true</activeByDefault>
</activation>
<build>
<finalName>${project.artifactId}-${project.version}.jre10</finalName>
<finalName>${project.artifactId}-${project.version}.jre10-preview</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
9 changes: 1 addition & 8 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3629,14 +3629,7 @@ void writeLong(long value) throws SQLServerException {
((Buffer) logBuffer).position(((Buffer) logBuffer).position() + 8);
}
} else {
valueBytes[0] = (byte) ((value >> 0) & 0xFF);
valueBytes[1] = (byte) ((value >> 8) & 0xFF);
valueBytes[2] = (byte) ((value >> 16) & 0xFF);
valueBytes[3] = (byte) ((value >> 24) & 0xFF);
valueBytes[4] = (byte) ((value >> 32) & 0xFF);
valueBytes[5] = (byte) ((value >> 40) & 0xFF);
valueBytes[6] = (byte) ((value >> 48) & 0xFF);
valueBytes[7] = (byte) ((value >> 56) & 0xFF);
Util.writeLong(value, valueBytes, 0);
writeWrappedBytes(valueBytes, 8);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

final class SQLJdbcVersion {
static final int major = 7;
static final int minor = 0;
static final int minor = 1;
static final int patch = 0;
static final int build = 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ byte[] encryptData(byte[] plainText) throws SQLServerException {
* @throws SQLServerException
*/
protected byte[] encryptData(byte[] plainText, boolean hasAuthenticationTag) throws SQLServerException {
aeLogger.entering(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(),
Thread.currentThread().getStackTrace()[1].getMethodName(), "Encrypting data.");
aeLogger.entering(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), "encryptData", "Encrypting data.");
// we will generate this initialization vector based whether
// this encryption type is deterministic
assert (plainText != null);
Expand Down Expand Up @@ -181,16 +180,14 @@ protected byte[] encryptData(byte[] plainText, boolean hasAuthenticationTag) thr
throw new SQLServerException(this, form.format(msgArgs), null, 0, false);
}

aeLogger.exiting(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(),
Thread.currentThread().getStackTrace()[1].getMethodName(), "Data encrypted.");
aeLogger.exiting(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), "encryptData", "Data encrypted.");
return outBuffer;

}

@Override
byte[] decryptData(byte[] cipherText) throws SQLServerException {
return decryptData(cipherText, true);

}

/**
Expand Down Expand Up @@ -289,8 +286,7 @@ private byte[] decryptData(byte[] cipherText, boolean hasAuthenticationTag) thro
* @throws SQLServerException
*/
private byte[] decryptData(byte[] iv, byte[] cipherText, int offset, int count) throws SQLServerException {
aeLogger.entering(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(),
Thread.currentThread().getStackTrace()[1].getMethodName(), "Decrypting data.");
aeLogger.entering(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), "decryptData", "Decrypting data.");
assert (cipherText != null);
assert (iv != null);
byte[] plainText = null;
Expand All @@ -299,7 +295,6 @@ private byte[] decryptData(byte[] iv, byte[] cipherText, int offset, int count)
IvParameterSpec ivector = new IvParameterSpec(iv);
Cipher decryptCipher;
try {
// AES encryption CBC mode and PKCS5 padding
decryptCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
decryptCipher.init(Cipher.DECRYPT_MODE, skeySpec, ivector);
plainText = decryptCipher.doFinal(cipherText, offset, count);
Expand All @@ -311,8 +306,7 @@ private byte[] decryptData(byte[] iv, byte[] cipherText, int offset, int count)
throw new SQLServerException(this, form.format(msgArgs), null, 0, false);
}

aeLogger.exiting(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(),
Thread.currentThread().getStackTrace()[1].getMethodName(), "Data decrypted.");
aeLogger.exiting(SQLServerAeadAes256CbcHmac256Algorithm.class.getName(), "decryptData", "Data decrypted.");
return plainText;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private CertificateDetails getCertificateDetailsByAlias(KeyStore keyStore, Strin
public byte[] encryptColumnEncryptionKey(String masterKeyPath, String encryptionAlgorithm,
byte[] plainTextColumnEncryptionKey) throws SQLServerException {
javaKeyStoreLogger.entering(SQLServerColumnEncryptionJavaKeyStoreProvider.class.getName(),
Thread.currentThread().getStackTrace()[1].getMethodName(), "Encrypting Column Encryption Key.");
"encryptColumnEncryptionKey", "Encrypting Column Encryption Key.");

byte[] version = KeyStoreProviderCommon.version;
KeyStoreProviderCommon.validateNonEmptyMasterKeyPath(masterKeyPath);
Expand Down Expand Up @@ -257,8 +257,7 @@ public byte[] encryptColumnEncryptionKey(String masterKeyPath, String encryption
System.arraycopy(signedHash, 0, encryptedColumnEncryptionKey, currentIndex, signedHash.length);

javaKeyStoreLogger.exiting(SQLServerColumnEncryptionJavaKeyStoreProvider.class.getName(),
Thread.currentThread().getStackTrace()[1].getMethodName(),
"Finished encrypting Column Encryption Key.");
"encryptColumnEncryptionKey", "Finished encrypting Column Encryption Key.");
return encryptedColumnEncryptionKey;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ final void doExecutePreparedStatement(PrepStmtExecCmd command) throws SQLServerE

ensureExecuteResultsReader(command.startResponse(getIsResponseBufferingAdaptive()));
startResults();
getNextResult();
getNextResult(true);
} catch (SQLException e) {
if (retryBasedOnFailedReuseOfCachedHandle(e, attempt, needsPrepare, false))
continue;
Expand Down Expand Up @@ -2763,7 +2763,7 @@ final void doExecutePreparedStatementBatch(PrepStmtBatchExecCmd batchCommand) th
// Get the first result from the batch. If there is no result for this batch
// then bail, leaving EXECUTE_FAILED in the current and remaining slots of
// the update count array.
if (!getNextResult())
if (!getNextResult(true))
return;

// If the result is a ResultSet (rather than an update count) then throw an
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,12 @@ public boolean next() throws SQLServerException {
if (UNKNOWN_ROW_COUNT == rowCount)
rowCount = currentRow;

// Read SQL Warnings at the end of ResultSet
if (stmt.resultsReader().peekTokenType() == TDS.TDS_MSG) {
stmt.startResults();
stmt.getNextResult(false);
}

currentRow = AFTER_LAST_ROW;
loggerExternal.exiting(getClassNameLogging(), "next", false);
return false;
Expand Down Expand Up @@ -2375,6 +2381,23 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
returnValue = getTime(columnIndex);
} else if (type == java.sql.Timestamp.class) {
returnValue = getTimestamp(columnIndex);
} else if (type == java.time.LocalDateTime.class || type == java.time.LocalDate.class
|| type == java.time.LocalTime.class) {
java.sql.Timestamp ts = getTimestamp(columnIndex,
Calendar.getInstance(java.util.TimeZone.getTimeZone("UTC")));
if (ts == null) {
returnValue = null;
} else {
java.time.LocalDateTime ldt = java.time.LocalDateTime.ofInstant(ts.toInstant(),
java.time.ZoneId.of("UTC"));
if (type == java.time.LocalDateTime.class) {
returnValue = ldt;
} else if (type == java.time.LocalDate.class) {
returnValue = ldt.toLocalDate();
} else {
returnValue = ldt.toLocalTime();
}
}
} else if (type == microsoft.sql.DateTimeOffset.class) {
returnValue = getDateTimeOffset(columnIndex);
} else if (type == UUID.class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ abstract class SQLServerSpatialDatatype {
*
* @param noZM
* flag to indicate if Z and M coordinates should be included
* @param type
* Type of Spatial Datatype (Geometry/Geography)
*/
protected void serializeToWkb(boolean noZM, SQLServerSpatialDatatype type) {
ByteBuffer buf = ByteBuffer.allocate(determineWkbCapacity());
Expand Down Expand Up @@ -172,6 +174,10 @@ protected void serializeToWkb(boolean noZM, SQLServerSpatialDatatype type) {
* Deserializes the buffer (that contains WKB representation of Geometry/Geography data), and stores it into
* multiple corresponding data structures.
*
* @param type
* Type of Spatial Datatype (Geography/Geometry)
* @throws SQLServerException
* if an Exception occurs
*/
protected void parseWkb(SQLServerSpatialDatatype type) throws SQLServerException {
srid = readInt();
Expand Down
Loading