#1333 - ENH: Support "dynamic formula" with findSingleAttributeList() ... e.g. .select("concat(lastName,', ',firstName)")

This commit is contained in:
Rob Bygrave
2018-03-06 17:29:45 +13:00
parent 05b8adbf6e
commit c1c85b67c2
12 changed files with 266 additions and 100 deletions
@@ -2,8 +2,10 @@ package io.ebeaninternal.server.querydefn;
import io.ebean.FetchConfig;
import io.ebean.util.StringHelper;
import io.ebeaninternal.server.util.DSelectColumnsParser;
import java.util.LinkedHashSet;
import java.util.List;
/**
* Parses the path properties string.
@@ -113,10 +115,10 @@ class OrmQueryPropertiesParser {
return null;
}
String[] res = inputProperties.split(",");
List<String> res = splitRawSelect(inputProperties);
StringBuilder sb = new StringBuilder(70);
LinkedHashSet<String> propertySet = new LinkedHashSet<>(res.length * 2);
LinkedHashSet<String> propertySet = new LinkedHashSet<>(res.size() * 2);
int count = 0;
String temp;
@@ -148,6 +150,13 @@ class OrmQueryPropertiesParser {
return propertySet;
}
/**
* Split allowing 'dynamic function based properties'.
*/
private List<String> splitRawSelect(String inputProperties) {
return DSelectColumnsParser.parse(inputProperties);
}
private int parseBatchHint(int pos, String option) {
int startPos = pos + option.length();