java.lang.Object
com.inductiveautomation.ignition.common.db.namedquery.QueryParser

public class QueryParser extends Object
  • Constructor Details

    • QueryParser

      public QueryParser()
  • Method Details

    • parse

      public static List<QueryParser.QueryToken> parse(String text)
    • 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 substitution
      parameters - 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 substitution
      parameters - NamedQuery parameters
      removeComments - 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