diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e909a89d..0fe6a5717 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
+## [6.3.4] Preview Release
+### Added
+- Added new ThreadGroup creation to prevent IllegalThreadStateException if the underlying ThreadGroup has been destroyed. [#474](https://github.com/Microsoft/mssql-jdbc/pull/474)
+- Added try-with-resources to JUnit tests [#520](https://github.com/Microsoft/mssql-jdbc/pull/520)
+
+### Fixed Issues
+- Fixed the issue with passing parameters names that start with '@' to a CallableStatement [#495](https://github.com/Microsoft/mssql-jdbc/pull/495)
+- Fixed SQLServerDataTable creation being O(n^2) issue [#514](https://github.com/Microsoft/mssql-jdbc/pull/514)
+
+### Changed
+- Changed some manual array copying to System.arraycopy() [#500](https://github.com/Microsoft/mssql-jdbc/pull/500)
+- Removed redundant toString() on String objects [#501](https://github.com/Microsoft/mssql-jdbc/pull/501)
+- Replaced literals with constants [#502](https://github.com/Microsoft/mssql-jdbc/pull/502)
+
## [6.3.3] Preview Release
### Added
- Added connection properties for specifying custom TrustManager [#74](https://github.com/Microsoft/mssql-jdbc/pull/74)
diff --git a/README.md b/README.md
index 2196f02d4..1edeca9e1 100644
--- a/README.md
+++ b/README.md
@@ -90,7 +90,7 @@ To get the latest preview version of the driver, add the following to your POM f
com.microsoft.sqlserver
mssql-jdbc
- 6.3.3.jre8-preview
+ 6.3.4.jre8-preview
```
@@ -120,7 +120,7 @@ Projects that require either of the two features need to explicitly declare the
com.microsoft.sqlserver
mssql-jdbc
- 6.3.3.jre8-preview
+ 6.3.4.jre8-preview
compile
diff --git a/pom.xml b/pom.xml
index 296eb209e..8c39911c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.microsoft.sqlserver
mssql-jdbc
- 6.3.4-SNAPSHOT
+ 6.3.4
jar
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java b/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java
index 6bf3af9e6..77891c37b 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java
@@ -439,9 +439,7 @@ private static byte[] convertToBytes(BigDecimal value,
}
}
int offset = numBytes - unscaledBytes.length;
- for (int i = offset; i < numBytes; ++i) {
- ret[i] = unscaledBytes[i - offset];
- }
+ System.arraycopy(unscaledBytes, offset - offset, ret, offset, numBytes - offset);
return ret;
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
index 4369d3c00..d87a9cb14 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
@@ -64,6 +64,7 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -498,7 +499,7 @@ class GregorianChange {
GregorianCalendar cal = new GregorianCalendar(Locale.US);
cal.clear();
- cal.set(1, 1, 577738, 0, 0, 0);// 577738 = 1+577737(no of days since epoch that brings us to oct 15th 1582)
+ cal.set(1, Calendar.FEBRUARY, 577738, 0, 0, 0);// 577738 = 1+577737(no of days since epoch that brings us to oct 15th 1582)
if (cal.get(Calendar.DAY_OF_MONTH) == 15) {
// If the date calculation is correct(the above bug is fixed),
// post the default gregorian cut over date, the pure gregorian date
@@ -4828,7 +4829,7 @@ private void writeInternalTVPRowValues(JDBCType jdbcType,
else {
if (isSqlVariant) {
writeTVPSqlVariantHeader(10, TDSType.FLOAT8.byteValue(), (byte) 0);
- writeDouble(Double.valueOf(currentColumnStringValue.toString()));
+ writeDouble(Double.valueOf(currentColumnStringValue));
break;
}
writeByte((byte) 8); // len of data bytes
@@ -7119,13 +7120,21 @@ final class TimeoutTimer implements Runnable {
private volatile Future> task;
private static final ExecutorService executor = Executors.newCachedThreadPool(new ThreadFactory() {
- private final ThreadGroup tg = new ThreadGroup(threadGroupName);
- private final String threadNamePrefix = tg.getName() + "-";
+ private final AtomicReference tgr = new AtomicReference<>();
private final AtomicInteger threadNumber = new AtomicInteger(0);
@Override
- public Thread newThread(Runnable r) {
- Thread t = new Thread(tg, r, threadNamePrefix + threadNumber.incrementAndGet());
+ public Thread newThread(Runnable r)
+ {
+ ThreadGroup tg = tgr.get();
+
+ if (tg == null || tg.isDestroyed())
+ {
+ tg = new ThreadGroup(threadGroupName);
+ tgr.set(tg);
+ }
+
+ Thread t = new Thread(tg, r, tg.getName() + "-" + threadNumber.incrementAndGet());
t.setDaemon(true);
return t;
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLJdbcVersion.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLJdbcVersion.java
index 9c9f7b691..2aa091ff0 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLJdbcVersion.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLJdbcVersion.java
@@ -11,6 +11,6 @@
final class SQLJdbcVersion {
static final int major = 6;
static final int minor = 3;
- static final int patch = 3;
+ static final int patch = 4;
static final int build = 0;
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java
index 14e4338b3..a383e1946 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java
@@ -1521,7 +1521,7 @@ private String createInsertBulkCommand(TDSWriter tdsWriter) throws SQLServerExce
if (it.hasNext()) {
bulkCmd.append(" with (");
while (it.hasNext()) {
- bulkCmd.append(it.next().toString());
+ bulkCmd.append(it.next());
if (it.hasNext()) {
bulkCmd.append(", ");
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy42Helper.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy42Helper.java
index ec44c1834..ea9ff510f 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy42Helper.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy42Helper.java
@@ -75,7 +75,7 @@ static Object getTemporalObjectFromCSVWithFormatter(String valueStrUntrimmed,
return ts;
case java.sql.Types.TIME:
// Time is returned as Timestamp to preserve nano seconds.
- cal.set(connection.baseYear(), 00, 01);
+ cal.set(connection.baseYear(), Calendar.JANUARY, 01);
ts = new java.sql.Timestamp(cal.getTimeInMillis());
ts.setNanos(taNano);
return new java.sql.Timestamp(ts.getTime());
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerCallableStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerCallableStatement.java
index 40a77be15..5ad8689c8 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerCallableStatement.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerCallableStatement.java
@@ -1451,6 +1451,15 @@ public NClob getNClob(String parameterName) throws SQLException {
if (paramNames != null)
l = paramNames.size();
+ // handle `@name` as well as `name`, since `@name` is what's returned
+ // by DatabaseMetaData#getProcedureColumns
+ String columnNameWithoutAtSign = null;
+ if (columnName.startsWith("@")) {
+ columnNameWithoutAtSign = columnName.substring(1, columnName.length());
+ } else {
+ columnNameWithoutAtSign = columnName;
+ }
+
// In order to be as accurate as possible when locating parameter name
// indexes, as well as be deterministic when running on various client
// locales, we search for parameter names using the following scheme:
@@ -1465,7 +1474,7 @@ public NClob getNClob(String parameterName) throws SQLException {
for (i = 0; i < l; i++) {
String sParam = paramNames.get(i);
sParam = sParam.substring(1, sParam.length());
- if (sParam.equals(columnName)) {
+ if (sParam.equals(columnNameWithoutAtSign)) {
matchPos = i;
break;
}
@@ -1477,7 +1486,7 @@ public NClob getNClob(String parameterName) throws SQLException {
for (i = 0; i < l; i++) {
String sParam = paramNames.get(i);
sParam = sParam.substring(1, sParam.length());
- if (sParam.equalsIgnoreCase(columnName)) {
+ if (sParam.equalsIgnoreCase(columnNameWithoutAtSign)) {
matchPos = i;
break;
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
index 730f13bf7..a8397b605 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
@@ -1717,7 +1717,7 @@ else if (0 == requestedPacketSize)
sPropKey = SQLServerDriverStringProperty.SSL_PROTOCOL.toString();
sPropValue = activeConnectionProperties.getProperty(sPropKey);
if (null == sPropValue) {
- sPropValue = SQLServerDriverStringProperty.SSL_PROTOCOL.getDefaultValue().toString();
+ sPropValue = SQLServerDriverStringProperty.SSL_PROTOCOL.getDefaultValue();
activeConnectionProperties.setProperty(sPropKey, sPropValue);
}
else {
@@ -5430,7 +5430,7 @@ String getInstancePort(String server,
browserResult = new String(receiveBuffer, 3, receiveBuffer.length - 3);
if (connectionlogger.isLoggable(Level.FINER))
connectionlogger.fine(
- toString() + " Received SSRP UDP response from IP address: " + udpResponse.getAddress().getHostAddress().toString());
+ toString() + " Received SSRP UDP response from IP address: " + udpResponse.getAddress().getHostAddress());
}
catch (IOException ioException) {
// Warn and retry
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java
index d3f176a31..60188841a 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java
@@ -13,10 +13,12 @@
import java.time.OffsetDateTime;
import java.time.OffsetTime;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import java.util.UUID;
public final class SQLServerDataTable {
@@ -24,6 +26,7 @@ public final class SQLServerDataTable {
int rowCount = 0;
int columnCount = 0;
Map columnMetadata = null;
+ Set columnNames = null;
Map rows = null;
private String tvpName = null;
@@ -37,6 +40,7 @@ public final class SQLServerDataTable {
// Name used in CREATE TYPE
public SQLServerDataTable() throws SQLServerException {
columnMetadata = new LinkedHashMap<>();
+ columnNames = new HashSet<>();
rows = new HashMap<>();
}
@@ -75,7 +79,7 @@ public synchronized Iterator> getIterator() {
public synchronized void addColumnMetadata(String columnName,
int sqlType) throws SQLServerException {
// column names must be unique
- Util.checkDuplicateColumnName(columnName, columnMetadata);
+ Util.checkDuplicateColumnName(columnName, columnNames);
columnMetadata.put(columnCount++, new SQLServerDataColumn(columnName, sqlType));
}
@@ -89,10 +93,11 @@ public synchronized void addColumnMetadata(String columnName,
*/
public synchronized void addColumnMetadata(SQLServerDataColumn column) throws SQLServerException {
// column names must be unique
- Util.checkDuplicateColumnName(column.columnName, columnMetadata);
+ Util.checkDuplicateColumnName(column.columnName, columnNames);
columnMetadata.put(columnCount++, column);
}
+
/**
* Adds one row of data to the data table.
*
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java
index 1d11e61af..dca580ec9 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java
@@ -793,7 +793,7 @@ public T unwrap(Class iface) throws SQLException {
}
catch (SQLException e) {
SQLServerException.makeFromDriverError(con, stmtParent, e.toString(), null, false);
- return 0;
+ return parameterModeUnknown;
}
}
@@ -913,7 +913,7 @@ public T unwrap(Class iface) throws SQLException {
}
catch (SQLException e) {
SQLServerException.makeFromDriverError(con, stmtParent, e.toString(), null, false);
- return 0;
+ return parameterNoNulls;
}
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
index 1ba3c62e8..2437a82d0 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
@@ -2503,8 +2503,7 @@ public long[] executeLargeBatch() throws SQLServerException, BatchUpdateExceptio
updateCounts = new long[batchCommand.updateCounts.length];
- for (int i = 0; i < batchCommand.updateCounts.length; ++i)
- updateCounts[i] = batchCommand.updateCounts[i];
+ System.arraycopy(batchCommand.updateCounts, 0, updateCounts, 0, batchCommand.updateCounts.length);
// Transform the SQLException into a BatchUpdateException with the update counts.
if (null != batchCommand.batchException) {
@@ -2571,8 +2570,7 @@ final void doExecutePreparedStatementBatch(PrepStmtBatchExecCmd batchCommand) th
// Fill in the parameter values for this batch
Parameter paramValues[] = batchParamValues.get(numBatchesPrepared);
assert paramValues.length == batchParam.length;
- for (int i = 0; i < paramValues.length; i++)
- batchParam[i] = paramValues[i];
+ System.arraycopy(paramValues, 0, batchParam, 0, paramValues.length);
boolean hasExistingTypeDefinitions = preparedTypeDefinitions != null;
boolean hasNewTypeDefinitions = buildPreparedStrings(batchParam, false);
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/TVP.java b/src/main/java/com/microsoft/sqlserver/jdbc/TVP.java
index 6f68d685a..fa3d07dd6 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/TVP.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/TVP.java
@@ -12,10 +12,12 @@
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.text.MessageFormat;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
enum TVPType {
ResultSet,
@@ -48,6 +50,7 @@ class TVP {
Iterator> sourceDataTableRowIterator = null;
ISQLServerDataRecord sourceRecord = null;
TVPType tvpType = null;
+ Set columnNames = null;
// MultiPartIdentifierState
enum MPIState {
@@ -94,6 +97,7 @@ void initTVP(TVPType type,
ISQLServerDataRecord tvpRecord) throws SQLServerException {
initTVP(TVPType.ISQLServerDataRecord, tvpPartName);
sourceRecord = tvpRecord;
+ columnNames = new HashSet<>();
// Populate TVP metdata from ISQLServerDataRecord.
populateMetadataFromDataRecord();
@@ -185,8 +189,9 @@ void populateMetadataFromDataRecord() throws SQLServerException {
throw new SQLServerException(SQLServerException.getErrString("R_TVPEmptyMetadata"), null);
}
for (int i = 0; i < sourceRecord.getColumnCount(); i++) {
+ Util.checkDuplicateColumnName(sourceRecord.getColumnMetaData(i + 1).columnName, columnNames);
+
// Make a copy here as we do not want to change user's metadata.
- Util.checkDuplicateColumnName(sourceRecord.getColumnMetaData(i + 1).columnName, columnMetadata);
SQLServerMetaData metaData = new SQLServerMetaData(sourceRecord.getColumnMetaData(i + 1));
columnMetadata.put(i, metaData);
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java
index db10ebce1..c1d6d81dc 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/Util.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/Util.java
@@ -19,6 +19,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
+import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.LogManager;
@@ -557,28 +558,22 @@ static String escapeSQLId(String inID) {
outID.append(']');
return outID.toString();
}
-
+
+ /**
+ * Checks if duplicate columns exists, in O(n) time.
+ *
+ * @param columnName
+ * the name of the column
+ * @throws SQLServerException
+ * when a duplicate column exists
+ */
static void checkDuplicateColumnName(String columnName,
- Map columnMetadata) throws SQLServerException {
- if (columnMetadata.get(0) instanceof SQLServerMetaData) {
- for (Entry entry : columnMetadata.entrySet()) {
- SQLServerMetaData value = (SQLServerMetaData) entry.getValue();
- if (value.columnName.equals(columnName)) {
- MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_TVPDuplicateColumnName"));
- Object[] msgArgs = {columnName};
- throw new SQLServerException(null, form.format(msgArgs), null, 0, false);
- }
- }
- }
- else if (columnMetadata.get(0) instanceof SQLServerDataColumn) {
- for (Entry entry : columnMetadata.entrySet()) {
- SQLServerDataColumn value = (SQLServerDataColumn) entry.getValue();
- if (value.columnName.equals(columnName)) {
- MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_TVPDuplicateColumnName"));
- Object[] msgArgs = {columnName};
- throw new SQLServerException(null, form.format(msgArgs), null, 0, false);
- }
- }
+ Set columnNames) throws SQLServerException {
+ //columnList.add will return false if the same column name already exists
+ if (!columnNames.add(columnName)) {
+ MessageFormat form = new MessageFormat(SQLServerException.getErrString("R_TVPDuplicateColumnName"));
+ Object[] msgArgs = {columnName};
+ throw new SQLServerException(null, form.format(msgArgs), null, 0, false);
}
}
diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java
index 6fc795a98..9ae2445c1 100644
--- a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java
+++ b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java
@@ -80,8 +80,6 @@ public class AESetup extends AbstractTest {
static SQLServerColumnEncryptionKeyStoreProvider storeProvider = null;
static SQLServerStatementColumnEncryptionSetting stmtColEncSetting = null;
- private static SQLServerPreparedStatement pstmt = null;
-
/**
* Create connection, statement and generate path of resource file
*
@@ -94,26 +92,28 @@ static void setUpConnection() throws TestAbortedException, Exception {
"Aborting test case as SQL Server version is not compatible with Always encrypted ");
String AETestConenctionString = connectionString + ";sendTimeAsDateTime=false";
-
readFromFile(javaKeyStoreInputFile, "Alias name");
- con = (SQLServerConnection) DriverManager.getConnection(AETestConenctionString);
- stmt = (SQLServerStatement) con.createStatement();
- dropCEK();
- dropCMK();
- con.close();
-
+
+ try(SQLServerConnection con = (SQLServerConnection) DriverManager.getConnection(AETestConenctionString);
+ SQLServerStatement stmt = (SQLServerStatement) con.createStatement()) {
+ dropCEK(stmt);
+ dropCMK(stmt);
+ }
+
keyPath = Utils.getCurrentClassPath() + jksName;
storeProvider = new SQLServerColumnEncryptionJavaKeyStoreProvider(keyPath, secretstrJks.toCharArray());
stmtColEncSetting = SQLServerStatementColumnEncryptionSetting.Enabled;
+
Properties info = new Properties();
info.setProperty("ColumnEncryptionSetting", "Enabled");
info.setProperty("keyStoreAuthentication", "JavaKeyStorePassword");
info.setProperty("keyStoreLocation", keyPath);
info.setProperty("keyStoreSecret", secretstrJks);
+
con = (SQLServerConnection) DriverManager.getConnection(AETestConenctionString, info);
stmt = (SQLServerStatement) con.createStatement();
createCMK(keyStoreName, javaKeyAliases);
- createCEK(storeProvider);
+ createCEK(storeProvider);
}
/**
@@ -126,8 +126,8 @@ static void setUpConnection() throws TestAbortedException, Exception {
@AfterAll
private static void dropAll() throws SQLServerException, SQLException {
dropTables(stmt);
- dropCEK();
- dropCMK();
+ dropCEK(stmt);
+ dropCMK(stmt);
Util.close(null, stmt, con);
}
@@ -140,33 +140,26 @@ private static void dropAll() throws SQLServerException, SQLException {
*/
private static void readFromFile(String inputFile,
String lookupValue) throws IOException {
- BufferedReader buffer = null;
filePath = Utils.getCurrentClassPath();
try {
File f = new File(filePath + inputFile);
assumeTrue(f.exists(), "Aborting test case since no java key store and alias name exists!");
- buffer = new BufferedReader(new FileReader(f));
- String readLine = "";
- String[] linecontents;
-
- while ((readLine = buffer.readLine()) != null) {
- if (readLine.trim().contains(lookupValue)) {
- linecontents = readLine.split(" ");
- javaKeyAliases = linecontents[2];
- break;
- }
+ try(BufferedReader buffer = new BufferedReader(new FileReader(f))) {
+ String readLine = "";
+ String[] linecontents;
+
+ while ((readLine = buffer.readLine()) != null) {
+ if (readLine.trim().contains(lookupValue)) {
+ linecontents = readLine.split(" ");
+ javaKeyAliases = linecontents[2];
+ break;
+ }
+ }
}
-
}
catch (IOException e) {
fail(e.toString());
}
- finally {
- if (null != buffer) {
- buffer.close();
- }
- }
-
}
/**
@@ -744,60 +737,60 @@ protected static void dropTables(SQLServerStatement statement) throws SQLExcepti
protected static void populateBinaryNormalCase(LinkedList byteValues) throws SQLException {
String sql = "insert into " + binaryTable + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?" + ")";
- pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting);
-
- // binary20
- for (int i = 1; i <= 3; i++) {
- if (null == byteValues) {
- pstmt.setBytes(i, null);
- }
- else {
- pstmt.setBytes(i, byteValues.get(0));
- }
- }
-
- // varbinary50
- for (int i = 4; i <= 6; i++) {
- if (null == byteValues) {
- pstmt.setBytes(i, null);
- }
- else {
- pstmt.setBytes(i, byteValues.get(1));
- }
- }
-
- // varbinary(max)
- for (int i = 7; i <= 9; i++) {
- if (null == byteValues) {
- pstmt.setBytes(i, null);
- }
- else {
- pstmt.setBytes(i, byteValues.get(2));
- }
+ try(SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting)) {
+
+ // binary20
+ for (int i = 1; i <= 3; i++) {
+ if (null == byteValues) {
+ pstmt.setBytes(i, null);
+ }
+ else {
+ pstmt.setBytes(i, byteValues.get(0));
+ }
+ }
+
+ // varbinary50
+ for (int i = 4; i <= 6; i++) {
+ if (null == byteValues) {
+ pstmt.setBytes(i, null);
+ }
+ else {
+ pstmt.setBytes(i, byteValues.get(1));
+ }
+ }
+
+ // varbinary(max)
+ for (int i = 7; i <= 9; i++) {
+ if (null == byteValues) {
+ pstmt.setBytes(i, null);
+ }
+ else {
+ pstmt.setBytes(i, byteValues.get(2));
+ }
+ }
+
+ // binary(512)
+ for (int i = 10; i <= 12; i++) {
+ if (null == byteValues) {
+ pstmt.setBytes(i, null);
+ }
+ else {
+ pstmt.setBytes(i, byteValues.get(3));
+ }
+ }
+
+ // varbinary(8000)
+ for (int i = 13; i <= 15; i++) {
+ if (null == byteValues) {
+ pstmt.setBytes(i, null);
+ }
+ else {
+ pstmt.setBytes(i, byteValues.get(4));
+ }
+ }
+
+ pstmt.execute();
}
-
- // binary(512)
- for (int i = 10; i <= 12; i++) {
- if (null == byteValues) {
- pstmt.setBytes(i, null);
- }
- else {
- pstmt.setBytes(i, byteValues.get(3));
- }
- }
-
- // varbinary(8000)
- for (int i = 13; i <= 15; i++) {
- if (null == byteValues) {
- pstmt.setBytes(i, null);
- }
- else {
- pstmt.setBytes(i, byteValues.get(4));
- }
- }
-
- pstmt.execute();
- Util.close(null, pstmt, null);
}
/**
@@ -809,60 +802,60 @@ protected static void populateBinaryNormalCase(LinkedList byteValues) th
protected static void populateBinarySetObject(LinkedList byteValues) throws SQLException {
String sql = "insert into " + binaryTable + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?" + ")";
- pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting);
-
- // binary(20)
- for (int i = 1; i <= 3; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, java.sql.Types.BINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(0));
- }
+ try(SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting)) {
+
+ // binary(20)
+ for (int i = 1; i <= 3; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, java.sql.Types.BINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(0));
+ }
+ }
+
+ // varbinary(50)
+ for (int i = 4; i <= 6; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, java.sql.Types.BINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(1));
+ }
+ }
+
+ // varbinary(max)
+ for (int i = 7; i <= 9; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, java.sql.Types.BINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(2));
+ }
+ }
+
+ // binary(512)
+ for (int i = 10; i <= 12; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, java.sql.Types.BINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(3));
+ }
+ }
+
+ // varbinary(8000)
+ for (int i = 13; i <= 15; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, java.sql.Types.BINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(4));
+ }
+ }
+
+ pstmt.execute();
}
-
- // varbinary(50)
- for (int i = 4; i <= 6; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, java.sql.Types.BINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(1));
- }
- }
-
- // varbinary(max)
- for (int i = 7; i <= 9; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, java.sql.Types.BINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(2));
- }
- }
-
- // binary(512)
- for (int i = 10; i <= 12; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, java.sql.Types.BINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(3));
- }
- }
-
- // varbinary(8000)
- for (int i = 13; i <= 15; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, java.sql.Types.BINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(4));
- }
- }
-
- pstmt.execute();
- Util.close(null, pstmt, null);
}
/**
@@ -874,60 +867,60 @@ protected static void populateBinarySetObject(LinkedList byteValues) thr
protected static void populateBinarySetObjectWithJDBCType(LinkedList byteValues) throws SQLException {
String sql = "insert into " + binaryTable + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?" + ")";
- pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting);
-
- // binary(20)
- for (int i = 1; i <= 3; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, JDBCType.BINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(0), JDBCType.BINARY);
- }
- }
-
- // varbinary(50)
- for (int i = 4; i <= 6; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, JDBCType.VARBINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(1), JDBCType.VARBINARY);
- }
- }
-
- // varbinary(max)
- for (int i = 7; i <= 9; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, JDBCType.VARBINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(2), JDBCType.VARBINARY);
- }
- }
-
- // binary(512)
- for (int i = 10; i <= 12; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, JDBCType.BINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(3), JDBCType.BINARY);
- }
- }
-
- // varbinary(8000)
- for (int i = 13; i <= 15; i++) {
- if (null == byteValues) {
- pstmt.setObject(i, null, JDBCType.VARBINARY);
- }
- else {
- pstmt.setObject(i, byteValues.get(4), JDBCType.VARBINARY);
- }
+ try(SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting)) {
+
+ // binary(20)
+ for (int i = 1; i <= 3; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, JDBCType.BINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(0), JDBCType.BINARY);
+ }
+ }
+
+ // varbinary(50)
+ for (int i = 4; i <= 6; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, JDBCType.VARBINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(1), JDBCType.VARBINARY);
+ }
+ }
+
+ // varbinary(max)
+ for (int i = 7; i <= 9; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, JDBCType.VARBINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(2), JDBCType.VARBINARY);
+ }
+ }
+
+ // binary(512)
+ for (int i = 10; i <= 12; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, JDBCType.BINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(3), JDBCType.BINARY);
+ }
+ }
+
+ // varbinary(8000)
+ for (int i = 13; i <= 15; i++) {
+ if (null == byteValues) {
+ pstmt.setObject(i, null, JDBCType.VARBINARY);
+ }
+ else {
+ pstmt.setObject(i, byteValues.get(4), JDBCType.VARBINARY);
+ }
+ }
+
+ pstmt.execute();
}
-
- pstmt.execute();
- Util.close(null, pstmt, null);
}
/**
@@ -938,30 +931,30 @@ protected static void populateBinarySetObjectWithJDBCType(LinkedList byt
protected static void populateBinaryNullCase() throws SQLException {
String sql = "insert into " + binaryTable + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?" + ")";
- pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting);
-
- // binary
- for (int i = 1; i <= 3; i++) {
- pstmt.setNull(i, java.sql.Types.BINARY);
+ try(SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting)) {
+
+ // binary
+ for (int i = 1; i <= 3; i++) {
+ pstmt.setNull(i, java.sql.Types.BINARY);
+ }
+
+ // varbinary, varbinary(max)
+ for (int i = 4; i <= 9; i++) {
+ pstmt.setNull(i, java.sql.Types.VARBINARY);
+ }
+
+ // binary512
+ for (int i = 10; i <= 12; i++) {
+ pstmt.setNull(i, java.sql.Types.BINARY);
+ }
+
+ // varbinary(8000)
+ for (int i = 13; i <= 15; i++) {
+ pstmt.setNull(i, java.sql.Types.VARBINARY);
+ }
+
+ pstmt.execute();
}
-
- // varbinary, varbinary(max)
- for (int i = 4; i <= 9; i++) {
- pstmt.setNull(i, java.sql.Types.VARBINARY);
- }
-
- // binary512
- for (int i = 10; i <= 12; i++) {
- pstmt.setNull(i, java.sql.Types.BINARY);
- }
-
- // varbinary(8000)
- for (int i = 13; i <= 15; i++) {
- pstmt.setNull(i, java.sql.Types.VARBINARY);
- }
-
- pstmt.execute();
- Util.close(null, pstmt, null);
}
/**
@@ -974,60 +967,60 @@ protected static void populateCharNormalCase(String[] charValues) throws SQLExce
String sql = "insert into " + charTable + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?,"
+ "?,?,?" + ")";
- pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting);
-
- // char
- for (int i = 1; i <= 3; i++) {
- pstmt.setString(i, charValues[0]);
- }
-
- // varchar
- for (int i = 4; i <= 6; i++) {
- pstmt.setString(i, charValues[1]);
- }
-
- // varchar(max)
- for (int i = 7; i <= 9; i++) {
- pstmt.setString(i, charValues[2]);
- }
-
- // nchar
- for (int i = 10; i <= 12; i++) {
- pstmt.setNString(i, charValues[3]);
+ try(SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting)) {
+
+ // char
+ for (int i = 1; i <= 3; i++) {
+ pstmt.setString(i, charValues[0]);
+ }
+
+ // varchar
+ for (int i = 4; i <= 6; i++) {
+ pstmt.setString(i, charValues[1]);
+ }
+
+ // varchar(max)
+ for (int i = 7; i <= 9; i++) {
+ pstmt.setString(i, charValues[2]);
+ }
+
+ // nchar
+ for (int i = 10; i <= 12; i++) {
+ pstmt.setNString(i, charValues[3]);
+ }
+
+ // nvarchar
+ for (int i = 13; i <= 15; i++) {
+ pstmt.setNString(i, charValues[4]);
+ }
+
+ // varchar(max)
+ for (int i = 16; i <= 18; i++) {
+ pstmt.setNString(i, charValues[5]);
+ }
+
+ // uniqueidentifier
+ for (int i = 19; i <= 21; i++) {
+ if (null == charValues[6]) {
+ pstmt.setUniqueIdentifier(i, null);
+ }
+ else {
+ pstmt.setUniqueIdentifier(i, uid);
+ }
+ }
+
+ // varchar8000
+ for (int i = 22; i <= 24; i++) {
+ pstmt.setString(i, charValues[7]);
+ }
+
+ // nvarchar4000
+ for (int i = 25; i <= 27; i++) {
+ pstmt.setNString(i, charValues[8]);
+ }
+
+ pstmt.execute();
}
-
- // nvarchar
- for (int i = 13; i <= 15; i++) {
- pstmt.setNString(i, charValues[4]);
- }
-
- // varchar(max)
- for (int i = 16; i <= 18; i++) {
- pstmt.setNString(i, charValues[5]);
- }
-
- // uniqueidentifier
- for (int i = 19; i <= 21; i++) {
- if (null == charValues[6]) {
- pstmt.setUniqueIdentifier(i, null);
- }
- else {
- pstmt.setUniqueIdentifier(i, uid);
- }
- }
-
- // varchar8000
- for (int i = 22; i <= 24; i++) {
- pstmt.setString(i, charValues[7]);
- }
-
- // nvarchar4000
- for (int i = 25; i <= 27; i++) {
- pstmt.setNString(i, charValues[8]);
- }
-
- pstmt.execute();
- Util.close(null, pstmt, null);
}
/**
@@ -1040,55 +1033,55 @@ protected static void populateCharSetObject(String[] charValues) throws SQLExcep
String sql = "insert into " + charTable + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?,"
+ "?,?,?" + ")";
- pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting);
-
- // char
- for (int i = 1; i <= 3; i++) {
- pstmt.setObject(i, charValues[0]);
- }
-
- // varchar
- for (int i = 4; i <= 6; i++) {
- pstmt.setObject(i, charValues[1]);
- }
-
- // varchar(max)
- for (int i = 7; i <= 9; i++) {
- pstmt.setObject(i, charValues[2], java.sql.Types.LONGVARCHAR);
+ try(SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting)) {
+
+ // char
+ for (int i = 1; i <= 3; i++) {
+ pstmt.setObject(i, charValues[0]);
+ }
+
+ // varchar
+ for (int i = 4; i <= 6; i++) {
+ pstmt.setObject(i, charValues[1]);
+ }
+
+ // varchar(max)
+ for (int i = 7; i <= 9; i++) {
+ pstmt.setObject(i, charValues[2], java.sql.Types.LONGVARCHAR);
+ }
+
+ // nchar
+ for (int i = 10; i <= 12; i++) {
+ pstmt.setObject(i, charValues[3], java.sql.Types.NCHAR);
+ }
+
+ // nvarchar
+ for (int i = 13; i <= 15; i++) {
+ pstmt.setObject(i, charValues[4], java.sql.Types.NCHAR);
+ }
+
+ // nvarchar(max)
+ for (int i = 16; i <= 18; i++) {
+ pstmt.setObject(i, charValues[5], java.sql.Types.LONGNVARCHAR);
+ }
+
+ // uniqueidentifier
+ for (int i = 19; i <= 21; i++) {
+ pstmt.setObject(i, charValues[6], microsoft.sql.Types.GUID);
+ }
+
+ // varchar8000
+ for (int i = 22; i <= 24; i++) {
+ pstmt.setObject(i, charValues[7]);
+ }
+
+ // nvarchar4000
+ for (int i = 25; i <= 27; i++) {
+ pstmt.setObject(i, charValues[8], java.sql.Types.NCHAR);
+ }
+
+ pstmt.execute();
}
-
- // nchar
- for (int i = 10; i <= 12; i++) {
- pstmt.setObject(i, charValues[3], java.sql.Types.NCHAR);
- }
-
- // nvarchar
- for (int i = 13; i <= 15; i++) {
- pstmt.setObject(i, charValues[4], java.sql.Types.NCHAR);
- }
-
- // nvarchar(max)
- for (int i = 16; i <= 18; i++) {
- pstmt.setObject(i, charValues[5], java.sql.Types.LONGNVARCHAR);
- }
-
- // uniqueidentifier
- for (int i = 19; i <= 21; i++) {
- pstmt.setObject(i, charValues[6], microsoft.sql.Types.GUID);
- }
-
- // varchar8000
- for (int i = 22; i <= 24; i++) {
- pstmt.setObject(i, charValues[7]);
- }
-
- // nvarchar4000
- for (int i = 25; i <= 27; i++) {
- pstmt.setObject(i, charValues[8], java.sql.Types.NCHAR);
- }
-
- pstmt.execute();
- Util.close(null, pstmt, null);
}
/**
@@ -1101,55 +1094,55 @@ protected static void populateCharSetObjectWithJDBCTypes(String[] charValues) th
String sql = "insert into " + charTable + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?,"
+ "?,?,?" + ")";
- pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting);
-
- // char
- for (int i = 1; i <= 3; i++) {
- pstmt.setObject(i, charValues[0], JDBCType.CHAR);
- }
-
- // varchar
- for (int i = 4; i <= 6; i++) {
- pstmt.setObject(i, charValues[1], JDBCType.VARCHAR);
- }
-
- // varchar(max)
- for (int i = 7; i <= 9; i++) {
- pstmt.setObject(i, charValues[2], JDBCType.LONGVARCHAR);
- }
-
- // nchar
- for (int i = 10; i <= 12; i++) {
- pstmt.setObject(i, charValues[3], JDBCType.NCHAR);
- }
-
- // nvarchar
- for (int i = 13; i <= 15; i++) {
- pstmt.setObject(i, charValues[4], JDBCType.NVARCHAR);
- }
-
- // nvarchar(max)
- for (int i = 16; i <= 18; i++) {
- pstmt.setObject(i, charValues[5], JDBCType.LONGNVARCHAR);
- }
-
- // uniqueidentifier
- for (int i = 19; i <= 21; i++) {
- pstmt.setObject(i, charValues[6], microsoft.sql.Types.GUID);
+ try(SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting)) {
+
+ // char
+ for (int i = 1; i <= 3; i++) {
+ pstmt.setObject(i, charValues[0], JDBCType.CHAR);
+ }
+
+ // varchar
+ for (int i = 4; i <= 6; i++) {
+ pstmt.setObject(i, charValues[1], JDBCType.VARCHAR);
+ }
+
+ // varchar(max)
+ for (int i = 7; i <= 9; i++) {
+ pstmt.setObject(i, charValues[2], JDBCType.LONGVARCHAR);
+ }
+
+ // nchar
+ for (int i = 10; i <= 12; i++) {
+ pstmt.setObject(i, charValues[3], JDBCType.NCHAR);
+ }
+
+ // nvarchar
+ for (int i = 13; i <= 15; i++) {
+ pstmt.setObject(i, charValues[4], JDBCType.NVARCHAR);
+ }
+
+ // nvarchar(max)
+ for (int i = 16; i <= 18; i++) {
+ pstmt.setObject(i, charValues[5], JDBCType.LONGNVARCHAR);
+ }
+
+ // uniqueidentifier
+ for (int i = 19; i <= 21; i++) {
+ pstmt.setObject(i, charValues[6], microsoft.sql.Types.GUID);
+ }
+
+ // varchar8000
+ for (int i = 22; i <= 24; i++) {
+ pstmt.setObject(i, charValues[7], JDBCType.VARCHAR);
+ }
+
+ // vnarchar4000
+ for (int i = 25; i <= 27; i++) {
+ pstmt.setObject(i, charValues[8], JDBCType.NVARCHAR);
+ }
+
+ pstmt.execute();
}
-
- // varchar8000
- for (int i = 22; i <= 24; i++) {
- pstmt.setObject(i, charValues[7], JDBCType.VARCHAR);
- }
-
- // vnarchar4000
- for (int i = 25; i <= 27; i++) {
- pstmt.setObject(i, charValues[8], JDBCType.NVARCHAR);
- }
-
- pstmt.execute();
- Util.close(null, pstmt, null);
}
/**
@@ -1161,46 +1154,46 @@ protected static void populateCharNullCase() throws SQLException {
String sql = "insert into " + charTable + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?,"
+ "?,?,?" + ")";
- pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting);
-
- // char
- for (int i = 1; i <= 3; i++) {
- pstmt.setNull(i, java.sql.Types.CHAR);
+ try(SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) Util.getPreparedStmt(con, sql, stmtColEncSetting)) {
+
+ // char
+ for (int i = 1; i <= 3; i++) {
+ pstmt.setNull(i, java.sql.Types.CHAR);
+ }
+
+ // varchar, varchar(max)
+ for (int i = 4; i <= 9; i++) {
+ pstmt.setNull(i, java.sql.Types.VARCHAR);
+ }
+
+ // nchar
+ for (int i = 10; i <= 12; i++) {
+ pstmt.setNull(i, java.sql.Types.NCHAR);
+ }
+
+ // nvarchar, varchar(max)
+ for (int i = 13; i <= 18; i++) {
+ pstmt.setNull(i, java.sql.Types.NVARCHAR);
+ }
+
+ // uniqueidentifier
+ for (int i = 19; i <= 21; i++) {
+ pstmt.setNull(i, microsoft.sql.Types.GUID);
+
+ }
+
+ // varchar8000
+ for (int i = 22; i <= 24; i++) {
+ pstmt.setNull(i, java.sql.Types.VARCHAR);
+ }
+
+ // nvarchar4000
+ for (int i = 25; i <= 27; i++) {
+ pstmt.setNull(i, java.sql.Types.NVARCHAR);
+ }
+
+ pstmt.execute();
}
-
- // varchar, varchar(max)
- for (int i = 4; i <= 9; i++) {
- pstmt.setNull(i, java.sql.Types.VARCHAR);
- }
-
- // nchar
- for (int i = 10; i <= 12; i++) {
- pstmt.setNull(i, java.sql.Types.NCHAR);
- }
-
- // nvarchar, varchar(max)
- for (int i = 13; i <= 18; i++) {
- pstmt.setNull(i, java.sql.Types.NVARCHAR);
- }
-
- // uniqueidentifier
- for (int i = 19; i <= 21; i++) {
- pstmt.setNull(i, microsoft.sql.Types.GUID);
-
- }
-
- // varchar8000
- for (int i = 22; i <= 24; i++) {
- pstmt.setNull(i, java.sql.Types.VARCHAR);
- }
-
- // nvarchar4000
- for (int i = 25; i <= 27; i++) {
- pstmt.setNull(i, java.sql.Types.NVARCHAR);
- }
-
- pstmt.execute();
- Util.close(null, pstmt, null);
}
/**
@@ -1212,40 +1205,40 @@ protected static void populateCharNullCase() throws SQLException {
protected static void populateDateNormalCase(LinkedList