Only intended for internal use within Spring's JDBC framework.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | PARAMETER_SEPARATORS
Set of characters that qualify as parameter separators, indicating that a parameter name in an SQL String has ended. |
| private static final boolean[] | separatorIndex
An index with separator flags per character code. |
| private static final String[] | START_SKIP
Set of characters that qualify as comment or quotes starting characters. |
| private static final String[] | STOP_SKIP
Set of characters that at are the corresponding comment or quotes ending characters. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static int | addNamedParameter(List<NamedParameterUtils.
|
| private static int | |
| public static List | buildSqlParameterList(ParsedSql
the parsed SQL statement parsedSql, SqlParameterSource the source for named parameters paramSource)Convert parameter declarations from an SqlParameterSource to a corresponding List of SqlParameters. |
| public static int[] | buildSqlTypeArray(ParsedSql
the parsed SQL statement parsedSql, SqlParameterSource the source for named parameters paramSource)Convert parameter types from an SqlParameterSource into a corresponding int array. |
| public static Object[] | Returns: the array of valuesthe parsed SQL statement parsedSql, SqlParameterSource the source for named parameters paramSource, List<SqlParameter> the List of declared SqlParameter objects
(may be declaredParams)null). If specified, the parameter metadata will
be built into the value array in the form of SqlParameterValue objects.Convert a Map of named parameter values to a corresponding array. |
| public static Object[] | Returns: the array of valuesthe SQL statement sql, Map<String, ?> the Map of parameters paramMap)Convert a Map of named parameter values to a corresponding array. |
| private static SqlParameter | Returns: the declared SqlParameter, ornull if none foundthe declared SqlParameter objects declaredParams, String the name of the desired parameter paramName, int the index of the desired parameter paramIndex)Find a matching parameter in the given list of declared parameters. |
| private static boolean | isParameterSeparator(char c)
Determine whether a parameter name ends at the current position, that is, whether the given character qualifies as a separator. |
| public static ParsedSql | Returns: the parsed statement, represented asParsedSql instancethe SQL statement sql)Parse the SQL statement and locate any placeholders or named parameters. |
| public static String | Returns: the actual (parsed) SQL statementthe SQL statement sql)Parse the SQL statement and locate any placeholders or named parameters. |
| private static int | Returns: next position to process after any comments or quotes are skippedcharacter array containing SQL statement statement, int current position of statement position)Skip over comments and quoted names present in an SQL statement. |
| public static String | Returns: the SQL statement with substituted parametersthe parsed representation of the SQL statement parsedSql, SqlParameterSource the source for named parameters paramSource)Parse the SQL statement and locate any placeholders or named parameters. |
| public static String | Returns: the SQL statement with substituted parametersthe SQL statement sql, SqlParameterSource the source for named parameters paramSource)Parse the SQL statement and locate any placeholders or named parameters. |
| PARAMETER_SEPARATORS | back to summary |
|---|---|
| private static final String PARAMETER_SEPARATORS Set of characters that qualify as parameter separators, indicating that a parameter name in an SQL String has ended. | |
| separatorIndex | back to summary |
|---|---|
| private static final boolean[] separatorIndex An index with separator flags per character code. Technically only needed between 34 and 124 at this point. | |
| START_SKIP | back to summary |
|---|---|
| private static final String[] START_SKIP Set of characters that qualify as comment or quotes starting characters. | |
| STOP_SKIP | back to summary |
|---|---|
| private static final String[] STOP_SKIP Set of characters that at are the corresponding comment or quotes ending characters. | |
| NamedParameterUtils | back to summary |
|---|---|
| public NamedParameterUtils() | |
| addNamedParameter | back to summary |
|---|---|
| private static int addNamedParameter(List<NamedParameterUtils. | |
| addNewNamedParameter | back to summary |
|---|---|
| private static int addNewNamedParameter(Set<String> namedParameters, int namedParameterCount, String parameter) | |
| buildSqlParameterList | back to summary |
|---|---|
| public static List Convert parameter declarations from an SqlParameterSource to a corresponding List of SqlParameters. This is necessary in order to reuse existing methods on JdbcTemplate. The SqlParameter for a named parameter is placed in the correct position in the resulting list based on the parsed SQL statement info.
| |
| buildSqlTypeArray | back to summary |
|---|---|
| public static int[] buildSqlTypeArray(ParsedSql parsedSql, SqlParameterSource paramSource) Convert parameter types from an SqlParameterSource into a corresponding int array. This is necessary in order to reuse existing methods on JdbcTemplate. Any named parameter types are placed in the correct position in the Object array based on the parsed SQL statement info.
| |
| buildValueArray | back to summary |
|---|---|
| public static Object[] buildValueArray(ParsedSql parsedSql, SqlParameterSource paramSource, List<SqlParameter> declaredParams) Convert a Map of named parameter values to a corresponding array.
| |
| buildValueArray | back to summary |
|---|---|
| public static Object[] buildValueArray(String sql, Map<String, ?> paramMap) Convert a Map of named parameter values to a corresponding array. This is a shortcut version of
| |
| findParameter | back to summary |
|---|---|
| private static SqlParameter findParameter(List<SqlParameter> declaredParams, String paramName, int paramIndex) Find a matching parameter in the given list of declared parameters.
| |
| isParameterSeparator | back to summary |
|---|---|
| private static boolean isParameterSeparator(char c) Determine whether a parameter name ends at the current position, that is, whether the given character qualifies as a separator. | |
| parseSqlStatement | back to summary |
|---|---|
| public static ParsedSql parseSqlStatement(String sql) Parse the SQL statement and locate any placeholders or named parameters. Named parameters are substituted for a JDBC placeholder. | |
| parseSqlStatementIntoString | back to summary |
|---|---|
| public static String parseSqlStatementIntoString(String sql) Parse the SQL statement and locate any placeholders or named parameters. Named parameters are substituted for a JDBC placeholder. This is a shortcut version of
| |
| skipCommentsAndQuotes | back to summary |
|---|---|
| private static int skipCommentsAndQuotes(char[] statement, int position) Skip over comments and quoted names present in an SQL statement.
| |
| substituteNamedParameters | back to summary |
|---|---|
| public static String substituteNamedParameters(ParsedSql parsedSql, SqlParameterSource paramSource) Parse the SQL statement and locate any placeholders or named parameters. Named
parameters are substituted for a JDBC placeholder, and any select list is expanded
to the required number of placeholders. Select lists may contain an array of
objects, 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: The parameter values passed in are used to determine the number of placeholders to be used for a select list. Select lists should be limited to 100 or fewer elements. A larger number of elements is not guaranteed to be supported by the database and is strictly vendor-dependent.
| |
| substituteNamedParameters | back to summary |
|---|---|
| public static String substituteNamedParameters(String sql, SqlParameterSource paramSource) Parse the SQL statement and locate any placeholders or named parameters. Named parameters are substituted for a JDBC placeholder and any select list is expanded to the required number of placeholders. This is a shortcut version of
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final String | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public String | |
| public int |
| endIndex | back to summary |
|---|---|
| private final int endIndex | |
| parameterName | back to summary |
|---|---|
| private final String parameterName | |
| startIndex | back to summary |
|---|---|
| private final int startIndex | |
| ParameterHolder | back to summary |
|---|---|
| public ParameterHolder(String parameterName, int startIndex, int endIndex) | |
| getEndIndex | back to summary |
|---|---|
| public int getEndIndex() | |
| getParameterName | back to summary |
|---|---|
| public String getParameterName() | |
| getStartIndex | back to summary |
|---|---|
| public int getStartIndex() | |