Browse Source

Merge branch '6.0.x'

pull/31091/head
Sam Brannen 1 year ago
parent
commit
5f893cadc5
  1. 16
      spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentPreparedStatementSetter.java
  2. 16
      spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentTypePreparedStatementSetter.java

16
spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentPreparedStatementSetter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,7 +22,8 @@ import java.sql.SQLException; @@ -22,7 +22,8 @@ import java.sql.SQLException;
import org.springframework.lang.Nullable;
/**
* Simple adapter for {@link PreparedStatementSetter} that applies a given array of arguments.
* Simple adapter for {@link PreparedStatementSetter} that applies a given array
* of arguments.
*
* @author Juergen Hoeller
* @since 3.2.3
@ -34,7 +35,7 @@ public class ArgumentPreparedStatementSetter implements PreparedStatementSetter, @@ -34,7 +35,7 @@ public class ArgumentPreparedStatementSetter implements PreparedStatementSetter,
/**
* Create a new ArgPreparedStatementSetter for the given arguments.
* Create a new {@code ArgumentPreparedStatementSetter} for the given arguments.
* @param args the arguments to set
*/
public ArgumentPreparedStatementSetter(@Nullable Object[] args) {
@ -53,14 +54,17 @@ public class ArgumentPreparedStatementSetter implements PreparedStatementSetter, @@ -53,14 +54,17 @@ public class ArgumentPreparedStatementSetter implements PreparedStatementSetter,
}
/**
* Set the value for prepared statements specified parameter index using the passed in value.
* This method can be overridden by subclasses if needed.
* Set the value for the prepared statement's specified parameter position
* using the supplied value.
* <p>This method can be overridden by subclasses if needed.
* @param ps the PreparedStatement
* @param parameterPosition index of the parameter position
* @param argValue the value to set
* @throws SQLException if thrown by PreparedStatement methods
*/
protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException {
protected void doSetValue(PreparedStatement ps, int parameterPosition, @Nullable Object argValue)
throws SQLException {
if (argValue instanceof SqlParameterValue paramValue) {
StatementCreatorUtils.setParameterValue(ps, parameterPosition, paramValue, paramValue.getValue());
}

16
spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentTypePreparedStatementSetter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,8 +25,8 @@ import org.springframework.dao.InvalidDataAccessApiUsageException; @@ -25,8 +25,8 @@ import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.lang.Nullable;
/**
* Simple adapter for {@link PreparedStatementSetter} that applies
* given arrays of arguments and JDBC argument types.
* Simple adapter for {@link PreparedStatementSetter} that applies the given
* arrays of arguments and JDBC argument types.
*
* @author Juergen Hoeller
* @since 3.2.3
@ -41,7 +41,8 @@ public class ArgumentTypePreparedStatementSetter implements PreparedStatementSet @@ -41,7 +41,8 @@ public class ArgumentTypePreparedStatementSetter implements PreparedStatementSet
/**
* Create a new ArgTypePreparedStatementSetter for the given arguments.
* Create a new {@code ArgumentTypePreparedStatementSetter} for the given
* arguments and types.
* @param args the arguments to set
* @param argTypes the corresponding SQL types of the arguments
*/
@ -84,15 +85,16 @@ public class ArgumentTypePreparedStatementSetter implements PreparedStatementSet @@ -84,15 +85,16 @@ public class ArgumentTypePreparedStatementSetter implements PreparedStatementSet
}
/**
* Set the value for the prepared statement's specified parameter position using the passed in
* value and type. This method can be overridden by subclasses if needed.
* Set the value for the prepared statement's specified parameter position
* using the supplied value and type.
* <p>This method can be overridden by subclasses if needed.
* @param ps the PreparedStatement
* @param parameterPosition index of the parameter position
* @param argType the argument type
* @param argValue the argument value
* @throws SQLException if thrown by PreparedStatement methods
*/
protected void doSetValue(PreparedStatement ps, int parameterPosition, int argType, Object argValue)
protected void doSetValue(PreparedStatement ps, int parameterPosition, int argType, @Nullable Object argValue)
throws SQLException {
StatementCreatorUtils.setParameterValue(ps, parameterPosition, argType, argValue);

Loading…
Cancel
Save