class JdbcParameterUtils {

	private JdbcParameterUtils() {
	}

	/**
	 * Count the occurrences of the character placeholder in an SQL string
	 * <code>sql</code>. The character placeholder is not counted if it appears within a
	 * literal, that is, surrounded by single or double quotes. This method will count
	 * traditional placeholders in the form of a question mark ('?') as well as named
	 * parameters indicated with a leading ':' or '&amp;'.
	 * <p>
	 * The code for this method is taken from an early version of the
	 * {@link org.springframework.jdbc.core.namedparam.NamedParameterUtils} class. That
	 * method was later removed after some refactoring, but the code is useful here for
	 * the Spring Batch project. The code has been altered to better suite the batch
	 * processing requirements.
	 * @param sql String to search in. Returns 0 if the given String is <code>null</code>.
	 * @param namedParameterHolder holder for the named parameters
	 * @return the number of named parameter placeholders
	 */
	public static int countParameterPlaceholders(String sql, List<String> namedParameterHolder) {<FILL_FUNCTION_BODY>}

	/**
	 * Determine whether a parameter name continues at the current position, that is, does
	 * not end delimited by any whitespace character yet.
	 * @param statement the SQL statement
	 * @param pos the position within the statement
	 */
	private static boolean parameterNameContinues(String statement, int pos) {
		char character = statement.charAt(pos);
		return (character != ' ' && character != ',' && character != ')' && character != '"' && character != '\''
				&& character != '|' && character != ';' && character != '\n' && character != '\r');
	}

}

		if (sql == null) {
			return 0;
		}

		boolean withinQuotes = false;
		Map<String, StringBuilder> namedParameters = new HashMap<>();
		char currentQuote = '-';
		int parameterCount = 0;
		int i = 0;
		while (i < sql.length()) {
			if (withinQuotes) {
				if (sql.charAt(i) == currentQuote) {
					withinQuotes = false;
					currentQuote = '-';
				}
			}
			else {
				if (sql.charAt(i) == '"' || sql.charAt(i) == '\'') {
					withinQuotes = true;
					currentQuote = sql.charAt(i);
				}
				else {
					if (sql.charAt(i) == ':' || sql.charAt(i) == '&') {
						int j = i + 1;
						StringBuilder parameter = new StringBuilder();
						while (j < sql.length() && parameterNameContinues(sql, j)) {
							parameter.append(sql.charAt(j));
							j++;
						}
						if (j - i > 1) {
							if (!namedParameters.containsKey(parameter.toString())) {
								parameterCount++;
								namedParameters.put(parameter.toString(), parameter);
								i = j - 1;
							}
						}
					}
					else {
						if (sql.charAt(i) == '?') {
							parameterCount++;
						}
					}
				}
			}
			i++;
		}
		if (namedParameterHolder != null) {
			namedParameterHolder.addAll(namedParameters.keySet());
		}
		return parameterCount;
	
<no_super_class>