SPR-7476 Improving named parameter parsing skipping escaped colons like '\:' and allowing for delimiting parameter names with curly brackets like :{p1}

This commit is contained in:
Thomas Risberg
2011-10-08 11:48:45 +00:00
parent 40d88fd991
commit 4f5248bb5c
2 changed files with 39 additions and 12 deletions

View File

@@ -189,8 +189,8 @@ public class NamedParameterUtilsTests {
*/
@Test
public void parseSqlStatementWithEscapedColon() throws Exception {
String expectedSql = "select foo from bar where baz < DATE(? 23:59:59) and baz = ?";
String sql = "select foo from bar where baz < DATE(:p1 23\\:59\\:59) and baz = :p2";
String expectedSql = "select '0\\:0' as a, foo from bar where baz < DATE(? 23:59:59) and baz = ?";
String sql = "select '0\\:0' as a, foo from bar where baz < DATE(:p1 23\\:59\\:59) and baz = :p2";
ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(sql);
assertEquals(2, parsedSql.getParameterNames().size());