Class QueryParser
java.lang.Object
com.inductiveautomation.ignition.common.db.namedquery.QueryParser
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<QueryParser.QueryToken>
parseAndRebuild
(NamedQuery query, Map<String, Object> parameters) parseAndRebuild
(NamedQuery query, Map<String, Object> parameters, boolean removeComments)
-
Constructor Details
-
QueryParser
public QueryParser()
-
-
Method Details
-
parse
-
parseAndRebuild
public static org.apache.commons.lang3.tuple.Pair<String,List<Object>> parseAndRebuild(NamedQuery query, Map<String, Object> parameters) throws Exception- Parameters:
query
- the query before substitutionparameters
- NamedQuery parameters- Returns:
- Left: the original query with QueryStrings replaced and Parameters substituted with '?'
Right: the parameter objects to be used in the query, in order, taken from the parameters map. - Throws:
Exception
- if the query tokens don't match the parameter keys
-
parseAndRebuild
public static org.apache.commons.lang3.tuple.Pair<String,List<Object>> parseAndRebuild(NamedQuery query, Map<String, Object> parameters, boolean removeComments) throws Exception- Parameters:
query
- the query before substitutionparameters
- NamedQuery parametersremoveComments
- boolean indicating whether comments with double dash (--) should be removed- Returns:
- Left: the original query with QueryStrings replaced, Parameters substituted with '?', and,
depending on "removeComments" flag, comments removed. Comments are removed using simple regex.
Right: the parameter objects to be used in the query, in order, taken from the parameters map. - Throws:
Exception
- if the query tokens don't match the parameter keys
-