Browse Source

Revise contribution

Closes gh-32380
pull/32386/head
Sam Brannen 2 years ago
parent
commit
6461eec582
  1. 14
      spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java
  2. 12
      spring-r2dbc/src/main/java/org/springframework/r2dbc/core/NamedParameterUtils.java

14
spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java

@ -273,9 +273,10 @@ public abstract class NamedParameterUtils {
* parentheses. This allows for the use of "expression lists" in the SQL statement * parentheses. This allows for the use of "expression lists" in the SQL statement
* like: <br /><br /> * like: <br /><br />
* {@code select id, name, state from table where (name, age) in (('John', 35), ('Ann', 50))} * {@code select id, name, state from table where (name, age) in (('John', 35), ('Ann', 50))}
* <p>The parameter values passed in are used to determine the number of placeholders to * <p>The parameter values passed in are used to determine the number of
* be used for a select list. Select lists should be limited to 100 or fewer elements and not be empty, * placeholders to be used for a select list. Select lists should not be empty
* A larger number of or empty elements is not guaranteed to be supported by the database and * and should be limited to 100 or fewer elements. An empty list or a larger
* number of elements is not guaranteed to be supported by the database and
* is strictly vendor-dependent. * is strictly vendor-dependent.
* @param parsedSql the parsed representation of the SQL statement * @param parsedSql the parsed representation of the SQL statement
* @param paramSource the source for named parameters * @param paramSource the source for named parameters
@ -460,7 +461,7 @@ public abstract class NamedParameterUtils {
/** /**
* Parse the SQL statement and locate any placeholders or named parameters. * Parse the SQL statement and locate any placeholders or named parameters.
* Named parameters are substituted for a JDBC placeholder. * <p>Named parameters are substituted for a JDBC placeholder.
* <p>This is a shortcut version of * <p>This is a shortcut version of
* {@link #parseSqlStatement(String)} in combination with * {@link #parseSqlStatement(String)} in combination with
* {@link #substituteNamedParameters(ParsedSql, SqlParameterSource)}. * {@link #substituteNamedParameters(ParsedSql, SqlParameterSource)}.
@ -474,9 +475,10 @@ public abstract class NamedParameterUtils {
/** /**
* Parse the SQL statement and locate any placeholders or named parameters. * Parse the SQL statement and locate any placeholders or named parameters.
* Named parameters are substituted for a JDBC placeholder and any select list * <p>Named parameters are substituted for a JDBC placeholder, and any select
* is expanded to the required number of placeholders. * list is expanded to the required number of placeholders.
* <p>This is a shortcut version of * <p>This is a shortcut version of
* {@link #parseSqlStatement(String)} in combination with
* {@link #substituteNamedParameters(ParsedSql, SqlParameterSource)}. * {@link #substituteNamedParameters(ParsedSql, SqlParameterSource)}.
* @param sql the SQL statement * @param sql the SQL statement
* @param paramSource the source for named parameters * @param paramSource the source for named parameters

12
spring-r2dbc/src/main/java/org/springframework/r2dbc/core/NamedParameterUtils.java

@ -275,9 +275,10 @@ abstract class NamedParameterUtils {
* and in that case the placeholders will be grouped and enclosed with parentheses. * and in that case the placeholders will be grouped and enclosed with parentheses.
* This allows for the use of "expression lists" in the SQL statement like: * This allows for the use of "expression lists" in the SQL statement like:
* {@code select id, name, state from table where (name, age) in (('John', 35), ('Ann', 50))} * {@code select id, name, state from table where (name, age) in (('John', 35), ('Ann', 50))}
* <p>The parameter values passed in are used to determine the number of placeholders to * <p>The parameter values passed in are used to determine the number of
* be used for a select list. Select lists should be limited to 100 or fewer elements. * placeholders to be used for a select list. Select lists should not be empty
* A larger number of elements is not guaranteed to be supported by the database and * and should be limited to 100 or fewer elements. An empty list or a larger
* number of elements is not guaranteed to be supported by the database and
* is strictly vendor-dependent. * is strictly vendor-dependent.
* @param parsedSql the parsed representation of the SQL statement * @param parsedSql the parsed representation of the SQL statement
* @param bindMarkersFactory the bind marker factory. * @param bindMarkersFactory the bind marker factory.
@ -361,8 +362,11 @@ abstract class NamedParameterUtils {
/** /**
* Parse the SQL statement and locate any placeholders or named parameters. * Parse the SQL statement and locate any placeholders or named parameters.
* Named parameters are substituted for a native placeholder and any * <p>Named parameters are substituted for a native placeholder and any
* select list is expanded to the required number of placeholders. * select list is expanded to the required number of placeholders.
* <p>This is a shortcut version of
* {@link #parseSqlStatement(String)} in combination with
* {@link #substituteNamedParameters(ParsedSql, BindMarkersFactory, BindParameterSource)}.
* @param sql the SQL statement * @param sql the SQL statement
* @param bindMarkersFactory the bind marker factory * @param bindMarkersFactory the bind marker factory
* @param paramSource the source for named parameters * @param paramSource the source for named parameters

Loading…
Cancel
Save