Interface SqlFunction

All Known Implementing Classes:
EndsWithFunction, LikeFunction, StartsWithFunction

public interface SqlFunction
A function which can be translated into SQL. These functions should be set in an SqlGenerator's context to allow expressions to use those functions.

This class defines a number of 'standard' functions, which can be used; they subclass the functions in EvalFunction of the same name, so that they can work in both the Evaluator and SqlGenerator AST visitors.

Author:
knoxg
  • Method Summary

    Modifier and Type
    Method
    Description
    toSql(String functionName, EvalContext evalContext, List<Object> arguments)
    All SQL functions must implement this method.
  • Method Details

    • toSql

      String toSql(String functionName, EvalContext evalContext, List<Object> arguments) throws EvalException, EvalFallbackException
      All SQL functions must implement this method. It returns the SQL required for the database to evaluate the function. evalContext can be used to get the database type, if required.
      Parameters:
      functionName - The name of the function being translated
      evalContext - The evaluation context of the SqlGenerator doing the translation
      arguments - The arguments to the function
      Returns:
      the SQL representation of the function
      Throws:
      EvalException - If an exception occured during translation (e.g. missing arguments, arguments of wrong type, invalid arguments).
      EvalFallbackException - If this expression should be evaluated at runtime instead of being translated