Skip to content

Commit c38bde2

Browse files
jhoellerunknown
authored and
unknown
committed
Polishing
Issue: SPR-10185
1 parent 9bfbe36 commit c38bde2

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java

+10-18
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ public static int javaTypeToSqlParameterType(Class javaType) {
120120
* @param inValue the value to set
121121
* @throws SQLException if thrown by PreparedStatement methods
122122
*/
123-
public static void setParameterValue(
124-
PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue)
123+
public static void setParameterValue(PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue)
125124
throws SQLException {
126125

127126
setParameterValueInternal(ps, paramIndex, param.getSqlType(), param.getTypeName(), param.getScale(), inValue);
@@ -137,8 +136,7 @@ public static void setParameterValue(
137136
* @throws SQLException if thrown by PreparedStatement methods
138137
* @see SqlTypeValue
139138
*/
140-
public static void setParameterValue(
141-
PreparedStatement ps, int paramIndex, int sqlType, Object inValue)
139+
public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, Object inValue)
142140
throws SQLException {
143141

144142
setParameterValueInternal(ps, paramIndex, sqlType, null, null, inValue);
@@ -156,9 +154,8 @@ public static void setParameterValue(
156154
* @throws SQLException if thrown by PreparedStatement methods
157155
* @see SqlTypeValue
158156
*/
159-
public static void setParameterValue(
160-
PreparedStatement ps, int paramIndex, int sqlType, String typeName, Object inValue)
161-
throws SQLException {
157+
public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, String typeName,
158+
Object inValue) throws SQLException {
162159

163160
setParameterValueInternal(ps, paramIndex, sqlType, typeName, null, inValue);
164161
}
@@ -177,9 +174,8 @@ public static void setParameterValue(
177174
* @throws SQLException if thrown by PreparedStatement methods
178175
* @see SqlTypeValue
179176
*/
180-
private static void setParameterValueInternal(
181-
PreparedStatement ps, int paramIndex, int sqlType, String typeName, Integer scale, Object inValue)
182-
throws SQLException {
177+
private static void setParameterValueInternal(PreparedStatement ps, int paramIndex, int sqlType,
178+
String typeName, Integer scale, Object inValue) throws SQLException {
183179

184180
String typeNameToUse = typeName;
185181
int sqlTypeToUse = sqlType;
@@ -190,8 +186,7 @@ private static void setParameterValueInternal(
190186
SqlParameterValue parameterValue = (SqlParameterValue) inValue;
191187
if (logger.isDebugEnabled()) {
192188
logger.debug("Overriding type info with runtime info from SqlParameterValue: column index " + paramIndex +
193-
", SQL type " + parameterValue.getSqlType() +
194-
", Type name " + parameterValue.getTypeName());
189+
", SQL type " + parameterValue.getSqlType() + ", type name " + parameterValue.getTypeName());
195190
}
196191
if (parameterValue.getSqlType() != SqlTypeValue.TYPE_UNKNOWN) {
197192
sqlTypeToUse = parameterValue.getSqlType();
@@ -221,9 +216,7 @@ private static void setParameterValueInternal(
221216
* Set the specified PreparedStatement parameter to null,
222217
* respecting database-specific peculiarities.
223218
*/
224-
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName)
225-
throws SQLException {
226-
219+
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName) throws SQLException {
227220
if (sqlType == SqlTypeValue.TYPE_UNKNOWN) {
228221
boolean useSetObject = false;
229222
sqlType = Types.NULL;
@@ -232,10 +225,9 @@ private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, S
232225
}
233226
catch (Throwable ex) {
234227
if (logger.isDebugEnabled()) {
235-
logger.debug("JDBC 3.0 getParameterType call not supported: " + ex);
228+
logger.debug("JDBC 3.0 getParameterType call not supported - using fallback method instead: " + ex);
236229
}
237-
// JDBC driver not compliant with JDBC 3.0
238-
// -> proceed with database-specific checks
230+
// JDBC driver not compliant with JDBC 3.0 -> proceed with database-specific checks
239231
try {
240232
DatabaseMetaData dbmd = ps.getConnection().getMetaData();
241233
String databaseProductName = dbmd.getDatabaseProductName();

0 commit comments

Comments
 (0)