|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2015 the original author or authors. |
| 2 | + * Copyright 2002-2017 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -70,7 +70,7 @@ public void substituteNamedParameters() {
|
70 | 70 |
|
71 | 71 | @Test
|
72 | 72 | public void convertParamMapToArray() {
|
73 |
| - Map<String, String> paramMap = new HashMap<String, String>(); |
| 73 | + Map<String, String> paramMap = new HashMap<>(); |
74 | 74 | paramMap.put("a", "a");
|
75 | 75 | paramMap.put("b", "b");
|
76 | 76 | paramMap.put("c", "c");
|
@@ -189,6 +189,26 @@ public void parseSqlStatementWithPostgresContainedOperator() throws Exception {
|
189 | 189 | assertEquals(expectedSql, NamedParameterUtils.substituteNamedParameters(parsedSql, null));
|
190 | 190 | }
|
191 | 191 |
|
| 192 | + @Test // SPR-15382 |
| 193 | + public void parseSqlStatementWithPostgresAnyArrayStringsExistsOperator() throws Exception { |
| 194 | + String expectedSql = "select '[\"3\", \"11\"]'::jsonb ?| '{1,3,11,12,17}'::text[]"; |
| 195 | + String sql = "select '[\"3\", \"11\"]'::jsonb ?| '{1,3,11,12,17}'::text[]"; |
| 196 | + |
| 197 | + ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(sql); |
| 198 | + assertEquals(0, parsedSql.getTotalParameterCount()); |
| 199 | + assertEquals(expectedSql, NamedParameterUtils.substituteNamedParameters(parsedSql, null)); |
| 200 | + } |
| 201 | + |
| 202 | + @Test // SPR-15382 |
| 203 | + public void parseSqlStatementWithPostgresAllArrayStringsExistsOperator() throws Exception { |
| 204 | + String expectedSql = "select '[\"3\", \"11\"]'::jsonb ?& '{1,3,11,12,17}'::text[] AND ? = 'Back in Black'"; |
| 205 | + String sql = "select '[\"3\", \"11\"]'::jsonb ?& '{1,3,11,12,17}'::text[] AND :album = 'Back in Black'"; |
| 206 | + |
| 207 | + ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(sql); |
| 208 | + assertEquals(1, parsedSql.getTotalParameterCount()); |
| 209 | + assertEquals(expectedSql, NamedParameterUtils.substituteNamedParameters(parsedSql, null)); |
| 210 | + } |
| 211 | + |
192 | 212 | @Test // SPR-7476
|
193 | 213 | public void parseSqlStatementWithEscapedColon() throws Exception {
|
194 | 214 | String expectedSql = "select '0\\:0' as a, foo from bar where baz < DATE(? 23:59:59) and baz = ?";
|
|
0 commit comments