Consistent support for square brackets around named parameter
See gh-27716
This commit is contained in:
@@ -55,7 +55,7 @@ public abstract class NamedParameterUtils {
|
||||
* Set of characters that qualify as parameter separators,
|
||||
* indicating that a parameter name in an SQL String has ended.
|
||||
*/
|
||||
private static final String PARAMETER_SEPARATORS = "\"':&,;()|=+-*%/\\<>^";
|
||||
private static final String PARAMETER_SEPARATORS = "\"':&,;()|=+-*%/\\<>^[]";
|
||||
|
||||
/**
|
||||
* An index with separator flags per character code.
|
||||
|
||||
@@ -319,4 +319,12 @@ public class NamedParameterUtilsTests {
|
||||
assertThat(psql2.getParameterNames().get(0)).isEqualTo("xxx");
|
||||
}
|
||||
|
||||
@Test // gh-27716
|
||||
public void parseSqlStatementWithSquareBracket() {
|
||||
String sql = "SELECT ARRAY[:ext]";
|
||||
ParsedSql psql = NamedParameterUtils.parseSqlStatement(sql);
|
||||
assertThat(psql.getNamedParameterCount()).isEqualTo(1);
|
||||
assertThat(psql.getParameterNames()).containsExactly("ext");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user