Skip to content

Commit 41a30c1

Browse files
committed
formatting
1 parent a67dc94 commit 41a30c1

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,8 @@ private void writeNullToTdsWriter(TDSWriter tdsWriter, int srcJdbcType,
20642064

20652065
private void writeColumnToTdsWriter(TDSWriter tdsWriter, int bulkPrecision, int bulkScale, int bulkJdbcType,
20662066
boolean bulkNullable, // should it be destNullable instead?
2067-
int srcColOrdinal, int destColOrdinal, boolean isStreaming, Object colValue, Calendar cal) throws SQLServerException {
2067+
int srcColOrdinal, int destColOrdinal, boolean isStreaming, Object colValue,
2068+
Calendar cal) throws SQLServerException {
20682069
SSType destSSType = destColumnMetadata.get(destColOrdinal).ssType;
20692070

20702071
bulkPrecision = validateSourcePrecision(bulkPrecision, bulkJdbcType,
@@ -2987,8 +2988,8 @@ private Object readColumnFromResultSet(int srcColOrdinal, int srcJdbcType, boole
29872988
/**
29882989
* Reads the given column from the result set current row and writes the data to tdsWriter.
29892990
*/
2990-
private void writeColumn(TDSWriter tdsWriter, int srcColOrdinal, int destColOrdinal,
2991-
Object colValue, Calendar cal) throws SQLServerException {
2991+
private void writeColumn(TDSWriter tdsWriter, int srcColOrdinal, int destColOrdinal, Object colValue,
2992+
Calendar cal) throws SQLServerException {
29922993
String destName = destColumnMetadata.get(destColOrdinal).columnName;
29932994
int srcPrecision, srcScale, destPrecision, srcJdbcType;
29942995
SSType destSSType = null;
@@ -3640,8 +3641,8 @@ private boolean writeBatchData(TDSWriter tdsWriter, TDSCommand command,
36403641
// Loop for each destination column. The mappings is a many to one mapping
36413642
// where multiple source columns can be mapped to one destination column.
36423643
for (ColumnMapping columnMapping : columnMappings) {
3643-
writeColumn(tdsWriter, columnMapping.sourceColumnOrdinal, columnMapping.destinationColumnOrdinal, null,
3644-
null // cell
3644+
writeColumn(tdsWriter, columnMapping.sourceColumnOrdinal, columnMapping.destinationColumnOrdinal,
3645+
null, null // cell
36453646
// value is
36463647
// retrieved
36473648
// inside

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ private void setPreparedStatementHandle(int handle) {
136136
/**
137137
* Regex for JDBC 'call' escape syntax
138138
*/
139-
private static final Pattern callEscapePattern = Pattern.compile("^\\s*(?i)\\{(\\s*\\??\\s*=?\\s*)call (.+)\\s*\\(?\\?*,?\\)?\\s*}\\s*$");
139+
private static final Pattern callEscapePattern = Pattern
140+
.compile("^\\s*(?i)\\{(\\s*\\??\\s*=?\\s*)call (.+)\\s*\\(?\\?*,?\\)?\\s*}\\s*$");
140141

141142
/**
142143
* Regex for 'exec' escape syntax
@@ -1235,7 +1236,8 @@ boolean callRPCDirectly(Parameter[] params) throws SQLServerException {
12351236
// 4. Compliant CALL escape syntax
12361237
// If isExecEscapeSyntax is true, EXEC escape syntax is used then use prior behaviour to
12371238
// execute the procedure
1238-
return (null != procedureName && paramCount != 0 && !isTVPType(params) && isCallEscapeSyntax && !isExecEscapeSyntax);
1239+
return (null != procedureName && paramCount != 0 && !isTVPType(params) && isCallEscapeSyntax
1240+
&& !isExecEscapeSyntax);
12391241
}
12401242

12411243
/**

src/test/java/com/microsoft/sqlserver/jdbc/callablestatement/CallableStatementTest.java

+5-8
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,7 @@ public void testExecSystemStoredProcedureNamedParametersAndIndexedParameterResul
11111111
public void testExecSystemStoredProcedureNoIndexedParametersResultSet() throws SQLException {
11121112
String call = "execute sp_sproc_columns_100 sp_getapplock, @ODBCVer=3, @fUsePattern=0";
11131113

1114-
try (CallableStatement cstmt = connection.prepareCall(call);
1115-
ResultSet rs = cstmt.executeQuery()) {
1114+
try (CallableStatement cstmt = connection.prepareCall(call); ResultSet rs = cstmt.executeQuery()) {
11161115
while (rs.next()) {
11171116
assertTrue(TestResource.getResource("R_resultSetEmpty"), !rs.getString(4).isEmpty());
11181117
}
@@ -1130,15 +1129,13 @@ public void testExecDocumentedSystemStoredProceduresIndexedParameters() throws S
11301129
serverName = rs.getString(1);
11311130
}
11321131

1133-
String[] sprocs = {"EXEC sp_column_privileges ?",
1134-
"exec sp_catalogs ?", "execute sp_column_privileges ?", "EXEC sp_column_privileges_ex ?",
1135-
"EXECUTE sp_columns ?", "execute sp_datatype_info ?",
1132+
String[] sprocs = {"EXEC sp_column_privileges ?", "exec sp_catalogs ?", "execute sp_column_privileges ?",
1133+
"EXEC sp_column_privileges_ex ?", "EXECUTE sp_columns ?", "execute sp_datatype_info ?",
11361134
"EXEC sp_sproc_columns ?", "EXECUTE sp_server_info ?", "exec sp_special_columns ?",
11371135
"execute sp_statistics ?", "EXEC sp_table_privileges ?", "exec sp_tables ?"};
11381136

1139-
Object[] params = {testTableName, serverName, testTableName, serverName,
1140-
testTableName, integer, "sp_column_privileges", integer, testTableName,
1141-
testTableName, testTableName, testTableName};
1137+
Object[] params = {testTableName, serverName, testTableName, serverName, testTableName, integer,
1138+
"sp_column_privileges", integer, testTableName, testTableName, testTableName, testTableName};
11421139

11431140
int paramIndex = 0;
11441141

src/test/java/com/microsoft/sqlserver/jdbc/unit/statement/BatchExecutionTest.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public void testValidTimezoneForTimestampBatchInsertWithBulkCopy() throws Except
170170
public void testValidTimezonesDstTimestampBatchInsertWithBulkCopy() throws Exception {
171171
Calendar gmtCal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
172172

173-
for (String tzId: TimeZone.getAvailableIDs()) {
173+
for (String tzId : TimeZone.getAvailableIDs()) {
174174
TimeZone.setDefault(TimeZone.getTimeZone(tzId));
175175

176176
long ms = 1696127400000L; // DST
@@ -191,8 +191,8 @@ public void testValidTimezonesDstTimestampBatchInsertWithBulkCopy() throws Excep
191191
}
192192

193193
// Insert Timestamp using bulkcopy for batch insert
194-
try (Connection con = DriverManager.getConnection(
195-
connectionString + ";useBulkCopyForBatchInsert=true;sendTemporalDataTypesAsStringForBulkCopy=false;");
194+
try (Connection con = DriverManager.getConnection(connectionString
195+
+ ";useBulkCopyForBatchInsert=true;sendTemporalDataTypesAsStringForBulkCopy=false;");
196196
PreparedStatement pstmt = con.prepareStatement("INSERT INTO " + timestampTable1 + " VALUES(?)")) {
197197

198198
Timestamp timestamp = new Timestamp(ms);
@@ -235,8 +235,9 @@ public void testBatchInsertTimestampNoTimezoneDoubleConversion() throws Exceptio
235235
long ms = 1578743412000L;
236236

237237
// Insert Timestamp using prepared statement when useBulkCopyForBatchInsert=true
238-
try (Connection con = DriverManager.getConnection(connectionString
239-
+ ";useBulkCopyForBatchInsert=true;sendTemporalDataTypesAsStringForBulkCopy=false;"); Statement stmt = con.createStatement();
238+
try (Connection con = DriverManager.getConnection(
239+
connectionString + ";useBulkCopyForBatchInsert=true;sendTemporalDataTypesAsStringForBulkCopy=false;");
240+
Statement stmt = con.createStatement();
240241
PreparedStatement pstmt = con.prepareStatement("INSERT INTO " + timestampTable2 + " VALUES(?)")) {
241242

242243
TestUtils.dropTableIfExists(timestampTable2, stmt);

0 commit comments

Comments
 (0)