Class Util

java.lang.Object
com.mckoi.database.sql.Util

public class Util extends Object
Various utility methods for the iterpreter.
Author:
Tobias Downer
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • asNonQuotedRef

      public static String asNonQuotedRef(Token token)
      Returns the Token as a non quoted reference. For example, a QUOTED_VARIABLE token will have the first and last '"' character removed. A QUOTED_DELIMINATED_REF will have " removed in each deliminated section. For example, '"re1"."re2"."a"' becomes 're1.re2.a" and '"re1.re2.a"' becomes 're1.re2.a'.
    • toParamObject

      public static Object toParamObject(Token token, boolean upper_identifiers)
      Converts a Token which is either a STRING_LITERAL, NUMBER_LITERAL or IDENTIFIER into a Java Object. If 'upper_identifiers' is true then all identifiers are made upper case before being returned (eg. if the object returns is a Variable object).
    • zeroNumber

      public static TObject zeroNumber()
      Returns numeric 0
    • parseNumberToken

      public static TObject parseNumberToken(Token token, boolean negative)
      Parses a NUMBER_LITERAL Token with a sign boolean.
    • toArrayParamObject

      public static TObject toArrayParamObject(Expression[] arr)
      Converts an expression array to an array type that can be added to an expression.
    • expressionListToString

      public static String expressionListToString(Expression[] list)
      Returns an array of Expression objects as a comma deliminated string.
    • normalize

      public static Expression normalize(Expression exp)
      Normalizes the Expression by removing all NOT operators and altering the expression as appropriate. For example, the expression; not ((a + b) = c and c = 5) would be normalized to; (a + b) <> c or c <> 5
    • resolveFunctionName

      public static FunctionDef resolveFunctionName(String name, Expression[] exp_list)
      Returns a Function object that represents the name and expression list (of parameters) of a function. Throws an exception if the function doesn't exist.