DATAJPA-1318 - Make query projection regex case insensitive.
Original pull request: #266.
This commit is contained in:
committed by
Jens Schauder
parent
0df48b1c5d
commit
34d3b9eed8
@@ -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+");
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user