Package com.mckoi.database.sql
Class Util
java.lang.Object
com.mckoi.database.sql.Util
Various utility methods for the iterpreter.
- Author:
- Tobias Downer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
asNonQuotedRef
(Token token) Returns the Token as a non quoted reference.static String
expressionListToString
(Expression[] list) Returns an array of Expression objects as a comma deliminated string.static Expression
normalize
(Expression exp) Normalizes the Expression by removing all NOT operators and altering the expression as appropriate.static TObject
parseNumberToken
(Token token, boolean negative) Parses a NUMBER_LITERAL Token with a sign boolean.static FunctionDef
resolveFunctionName
(String name, Expression[] exp_list) Returns a Function object that represents the name and expression list (of parameters) of a function.static TObject
toArrayParamObject
(Expression[] arr) Converts an expression array to an array type that can be added to an expression.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.static TObject
Returns numeric 0
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
asNonQuotedRef
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
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
Returns numeric 0 -
parseNumberToken
Parses a NUMBER_LITERAL Token with a sign boolean. -
toArrayParamObject
Converts an expression array to an array type that can be added to an expression. -
expressionListToString
Returns an array of Expression objects as a comma deliminated string. -
normalize
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) invalid input: '<'> c or c invalid input: '<'> 5 -
resolveFunctionName
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.
-