Package org.firebirdsql.jdbc.escape
Class FBEscapedFunctionHelper
- java.lang.Object
-
- org.firebirdsql.jdbc.escape.FBEscapedFunctionHelper
-
public class FBEscapedFunctionHelper extends java.lang.Object
Helper class for escaped functions.- Author:
- Roman Rokytskyy, Mark Rotteveel
-
-
Constructor Summary
Constructors Constructor Description FBEscapedFunctionHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
abs(java.lang.String[] params)
Produce a function call for theabs
UDF function.static java.lang.String
acos(java.lang.String[] params)
Produce a function call for theacos
UDF function.static java.lang.String
asin(java.lang.String[] params)
Produce a function call for theasin
UDF function.static java.lang.String
atan(java.lang.String[] params)
Produce a function call for theatan
UDF function.static java.lang.String
atan2(java.lang.String[] params)
Produce a function call for theatan2
UDF function.static java.lang.String
ceiling(java.lang.String[] params)
Produce a function call for theceiling
UDF function.static java.lang.String
convertTemplate(java.lang.String functionCall, FBEscapedParser.EscapeParserMode mode)
Convert escaped function call using function template.static java.lang.String
cos(java.lang.String[] params)
Produce a function call for thecos
UDF function.static java.lang.String
cot(java.lang.String[] params)
Produce a function call for thecot
UDF function.static java.lang.String
floor(java.lang.String[] params)
Produce a function call for thefloor
UDF function.static java.util.Set<java.lang.String>
getSupportedNumericFunctions()
static java.util.Set<java.lang.String>
getSupportedStringFunctions()
static java.util.Set<java.lang.String>
getSupportedSystemFunctions()
static java.util.Set<java.lang.String>
getSupportedTimeDateFunctions()
static java.lang.String
log10(java.lang.String[] params)
Produce a function call for thelog10
UDF function.static java.lang.String
mod(java.lang.String[] params)
Produce a function call for themod
UDF function.static java.util.List<java.lang.String>
parseArguments(java.lang.String functionCall)
Extract function arguments from the function call.static java.lang.String
parseFunction(java.lang.String functionCall)
Extract function name from the function call.static java.lang.String
pi(java.lang.String[] params)
Produce a function call for thepi
UDF function.static java.lang.String
rand(java.lang.String[] params)
Produce a function call for therand
UDF function.static java.lang.String
sign(java.lang.String[] params)
Produce a function call for thesign
UDF function.static java.lang.String
sin(java.lang.String[] params)
Produce a function call for thesin
UDF function.static java.lang.String
sqrt(java.lang.String[] params)
Produce a function call for thesqrt
UDF function.static java.lang.String
tan(java.lang.String[] params)
Produce a function call for thetan UDF function.
-
-
-
Method Detail
-
parseFunction
public static java.lang.String parseFunction(java.lang.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 java.util.List<java.lang.String> parseArguments(java.lang.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 java.lang.String convertTemplate(java.lang.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 java.lang.String abs(java.lang.String[] params) throws FBSQLParseException
Produce a function call for theabs
UDF function. The syntax of theabs
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 java.lang.String acos(java.lang.String[] params) throws FBSQLParseException
Produce a function call for theacos
UDF function. The syntax of theacos
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 java.lang.String asin(java.lang.String[] params) throws FBSQLParseException
Produce a function call for theasin
UDF function. The syntax of theasin
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 java.lang.String atan(java.lang.String[] params) throws FBSQLParseException
Produce a function call for theatan
UDF function. The syntax of theatan
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 java.lang.String atan2(java.lang.String[] params) throws FBSQLParseException
Produce a function call for theatan2
UDF function. The syntax of theatan2
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 java.lang.String ceiling(java.lang.String[] params) throws FBSQLParseException
Produce a function call for theceiling
UDF function. The syntax of theceiling
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 java.lang.String cos(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thecos
UDF function. The syntax of thecos
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 java.lang.String cot(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thecot
UDF function. The syntax of thecot
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 java.lang.String floor(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thefloor
UDF function. The syntax of thefloor
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 java.lang.String log10(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thelog10
UDF function. The syntax of thelog10
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 java.lang.String mod(java.lang.String[] params) throws FBSQLParseException
Produce a function call for themod
UDF function. The syntax of themod
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 java.lang.String pi(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thepi
UDF function. The syntax of thepi
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 java.lang.String rand(java.lang.String[] params) throws FBSQLParseException
Produce a function call for therand
UDF function. The syntax for therand
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 java.lang.String sign(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thesign
UDF function. The syntax for thesign
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 java.lang.String sin(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thesin
UDF function. The syntax for thesin
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 java.lang.String sqrt(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thesqrt
UDF function. The syntax for thesqrt
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 java.lang.String tan(java.lang.String[] params) throws FBSQLParseException
Produce a function call for thetan 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 java.util.Set<java.lang.String> getSupportedNumericFunctions()
- Returns:
- Set of JDBC numeric functions supported (as defined in appendix D.1 of JDBC 4.1)
-
getSupportedStringFunctions
public static java.util.Set<java.lang.String> getSupportedStringFunctions()
- Returns:
- Set of JDBC string functions supported (as defined in appendix D.2 of JDBC 4.1)
-
getSupportedTimeDateFunctions
public static java.util.Set<java.lang.String> getSupportedTimeDateFunctions()
- Returns:
- Set of JDBC time and date functions supported (as defined in appendix D.3 of JDBC 4.1)
-
getSupportedSystemFunctions
public static java.util.Set<java.lang.String> getSupportedSystemFunctions()
- Returns:
- Set of JDBC system functions supported (as defined in appendix D.4 of JDBC 4.1)
-
-