Package com.arcadedb.query.sql.executor
Interface SQLFunction
-
- All Known Implementing Classes:
SQLFunctionAbsoluteValue
,SQLFunctionAbstract
,SQLFunctionAstar
,SQLFunctionAverage
,SQLFunctionBoth
,SQLFunctionBothE
,SQLFunctionBothV
,SQLFunctionCoalesce
,SQLFunctionConcat
,SQLFunctionConfigurableAbstract
,SQLFunctionCount
,SQLFunctionDate
,SQLFunctionDecode
,SQLFunctionDifference
,SQLFunctionDijkstra
,SQLFunctionDistance
,SQLFunctionEncode
,SQLFunctionFirst
,SQLFunctionFormat
,SQLFunctionHeuristicPathFinderAbstract
,SQLFunctionIf
,SQLFunctionIfNull
,SQLFunctionIn
,SQLFunctionInE
,SQLFunctionIntersect
,SQLFunctionInV
,SQLFunctionLast
,SQLFunctionList
,SQLFunctionMap
,SQLFunctionMathAbstract
,SQLFunctionMax
,SQLFunctionMedian
,SQLFunctionMin
,SQLFunctionMode
,SQLFunctionMove
,SQLFunctionMoveFiltered
,SQLFunctionMultiValueAbstract
,SQLFunctionOut
,SQLFunctionOutE
,SQLFunctionOutV
,SQLFunctionPathFinder
,SQLFunctionPercentile
,SQLFunctionSet
,SQLFunctionShortestPath
,SQLFunctionStandardDeviation
,SQLFunctionStrcmpci
,SQLFunctionSum
,SQLFunctionSymmetricDifference
,SQLFunctionSysdate
,SQLFunctionUnionAll
,SQLFunctionUUID
,SQLFunctionVariance
,SQLStaticReflectiveFunction
public interface SQLFunction
Interface that defines a SQL Function. Functions can be state-less if registered as instance, or state-full when registered as class. State-less function are reused across queries, so don't keep any run-time information inside of it. State-full function, instead, stores Implement it and register it with: OSQLParser.getInstance().registerFunction() to being used by the SQL engine.??? could it be possible to have a small piece of code here showing where to register a function using services ???
- Author:
- Luca Garulli (l.garulli--(at)--gmail.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
aggregateResults()
A function can make calculation on several records before returning a result.void
config(Object[] configuredParameters)
Configure the function.Object
execute(Object iThis, Identifiable iCurrentRecord, Object iCurrentResult, Object[] iParams, CommandContext iContext)
Process a record.String
getName()
Function name, the name is used by the sql parser to identify a call this function.Object
getResult()
Only called when function aggregates results after all records have been passed to the function.String
getSyntax()
Returns a convenient SQL String representation of the function.
-
-
-
Method Detail
-
execute
Object execute(Object iThis, Identifiable iCurrentRecord, Object iCurrentResult, Object[] iParams, CommandContext iContext)
Process a record.- Parameters:
iThis
-iCurrentRecord
- : current recordiCurrentResult
- TODOiParams
- : function parameters, number is ensured to be within minParams and maxParams.iContext
- : object calling this function- Returns:
- function result, can be null. Special cases : can be null if function aggregate results, can be null if function filter results : this mean result is excluded
-
config
void config(Object[] configuredParameters)
Configure the function.- Parameters:
configuredParameters
-
-
aggregateResults
boolean aggregateResults()
A function can make calculation on several records before returning a result.Example of such function : sum, count, max, min ...
The final result of the aggregation is obtained by calling
getResult()
- Returns:
- true if function aggregate results
-
getName
String getName()
Function name, the name is used by the sql parser to identify a call this function.- Returns:
- String , function name, never null or empty.
-
getSyntax
String getSyntax()
Returns a convenient SQL String representation of the function.Example :
myFunction( param1, param2, [optionalParam3])
This text will be used in exception messages.
- Returns:
- String , never null.
-
getResult
Object getResult()
Only called when function aggregates results after all records have been passed to the function.- Returns:
- Aggregation result
-
-