Class FBEscapedFunctionHelper

java.lang.Object
org.firebirdsql.jdbc.escape.FBEscapedFunctionHelper

public class FBEscapedFunctionHelper extends Object
Helper class for escaped functions.
Author:
Roman Rokytskyy, Mark Rotteveel
  • Constructor Details

    • FBEscapedFunctionHelper

      public FBEscapedFunctionHelper()
  • Method Details

    • parseFunction

      public static String parseFunction(String functionCall) throws FBSQLParseException
      Extract function name from the function call.
      Parameters:
      functionCall - escaped function call.
      Returns:
      name of the function.
      Throws:
      FBSQLParseException - if parse error occurs.
    • parseArguments

      public static List<String> parseArguments(String functionCall) throws FBSQLParseException
      Extract function arguments from the function call. This method parses escaped function call string and extracts function parameters from it.
      Parameters:
      functionCall - escaped function call.
      Returns:
      list of parameters of the function.
      Throws:
      FBSQLParseException - if parse error occurs.
    • convertTemplate

      public static String convertTemplate(String functionCall, FBEscapedParser.EscapeParserMode mode) throws FBSQLParseException
      Convert escaped function call using function template.
      Parameters:
      functionCall - escaped function call.
      Returns:
      server-side representation of the function call or null if no template found.
      Throws:
      FBSQLParseException - if escaped function call has incorrect syntax.
    • abs

      public static String abs(String[] params) throws FBSQLParseException
      Produce a function call for the abs UDF function. The syntax of the abs function is {fn abs(number)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • acos

      public static String acos(String[] params) throws FBSQLParseException
      Produce a function call for the acos UDF function. The syntax of the acos function is {fn acos(float)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • asin

      public static String asin(String[] params) throws FBSQLParseException
      Produce a function call for the asin UDF function. The syntax of the asin function is {fn asin(float)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • atan

      public static String atan(String[] params) throws FBSQLParseException
      Produce a function call for the atan UDF function. The syntax of the atan function is {fn atan(float)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • atan2

      public static String atan2(String[] params) throws FBSQLParseException
      Produce a function call for the atan2 UDF function. The syntax of the atan2 function is {fn atan2(float1, float2)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • ceiling

      public static String ceiling(String[] params) throws FBSQLParseException
      Produce a function call for the ceiling UDF function. The syntax of the ceiling function is {fn ceiling(number)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • cos

      public static String cos(String[] params) throws FBSQLParseException
      Produce a function call for the cos UDF function. The syntax of the cos function is {fn cos(float)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • cot

      public static String cot(String[] params) throws FBSQLParseException
      Produce a function call for the cot UDF function. The syntax of the cot function is {fn cot(float)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • floor

      public static String floor(String[] params) throws FBSQLParseException
      Produce a function call for the floor UDF function. The syntax of the floor function is {fn floor(number)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • log10

      public static String log10(String[] params) throws FBSQLParseException
      Produce a function call for the log10 UDF function. The syntax of the log10 function is {fn log10(number)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • mod

      public static String mod(String[] params) throws FBSQLParseException
      Produce a function call for the mod UDF function. The syntax of the mod function is {fn mod(integer1, integer2)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • pi

      public static String pi(String[] params) throws FBSQLParseException
      Produce a function call for the pi UDF function. The syntax of the pi function is {fn pi()}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • rand

      public static String rand(String[] params) throws FBSQLParseException
      Produce a function call for the rand UDF function. The syntax for the rand function is {fn rand()}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • sign

      public static String sign(String[] params) throws FBSQLParseException
      Produce a function call for the sign UDF function. The syntax for the sign function is {fn sign(number)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • sin

      public static String sin(String[] params) throws FBSQLParseException
      Produce a function call for the sin UDF function. The syntax for the sin function is {fn sin(float)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • sqrt

      public static String sqrt(String[] params) throws FBSQLParseException
      Produce a function call for the sqrt UDF function. The syntax for the sqrt function is {fn sqrt(number)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • tan

      public static String tan(String[] params) throws FBSQLParseException
      Produce a function call for the tan UDF function. The syntax for the tan function is {fn tan(float)}.
      Parameters:
      params - The parameters to be used in the call
      Throws:
      FBSQLParseException - if there is an error with the parameters
    • getSupportedNumericFunctions

      public static Set<String> getSupportedNumericFunctions()
      Returns:
      Set of JDBC numeric functions supported (as defined in appendix D.1 of JDBC 4.1)
    • getSupportedStringFunctions

      public static Set<String> getSupportedStringFunctions()
      Returns:
      Set of JDBC string functions supported (as defined in appendix D.2 of JDBC 4.1)
    • getSupportedTimeDateFunctions

      public static Set<String> getSupportedTimeDateFunctions()
      Returns:
      Set of JDBC time and date functions supported (as defined in appendix D.3 of JDBC 4.1)
    • getSupportedSystemFunctions

      public static Set<String> getSupportedSystemFunctions()
      Returns:
      Set of JDBC system functions supported (as defined in appendix D.4 of JDBC 4.1)