DATAJPA-1318 - Make query projection regex case insensitive.

Original pull request: #266.
This commit is contained in:
Nils Borrmann
2018-04-05 22:42:23 +02:00
committed by Jens Schauder
parent 0df48b1c5d
commit 34d3b9eed8
2 changed files with 4 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ import org.springframework.util.StringUtils;
* @author Mark Paluch
* @author Sébastien Péralta
* @author Jens Schauder
* @author Nils Borrmann
*/
public abstract class QueryUtils {
@@ -96,7 +97,7 @@ public abstract class QueryUtils {
private static final Pattern ALIAS_MATCH;
private static final Pattern COUNT_MATCH;
private static final Pattern PROJECTION_CLAUSE = Pattern.compile("select\\s+(.+)\\s+from");
private static final Pattern PROJECTION_CLAUSE = Pattern.compile("select\\s+(.+)\\s+from", Pattern.CASE_INSENSITIVE);
private static final Pattern NO_DIGITS = Pattern.compile("\\D+");

View File

@@ -37,6 +37,7 @@ import org.springframework.data.repository.query.parser.Part.Type;
* @author Oliver Gierke
* @author Thomas Darimont
* @author Jens Schauder
* @author Nils Borrmann
*/
public class StringQueryUnitTests {
@@ -314,7 +315,7 @@ public class StringQueryUnitTests {
@Test // DATAJPA-1235
public void getProjection() {
checkProjection("SELECT something FROM", "", "only lowercase is supported (!?)");
checkProjection("SELECT something FROM", "something", "uppercase is supported");
checkProjection("select something from", "something", "single expression");
checkProjection("select x, y, z from", "x, y, z", "tuple");
checkProjection("sect x, y, z from", "", "missing select");