Class SqlFunction
java.lang.Object
com.gigaspaces.query.sql.functions.SqlFunction
- Direct Known Subclasses:
AbsSqlFunction, AppendSqlFunction, CastSqlFunction, CeilSqlFunction, CharLengthSqlFunction, ChrSqlFunction, CoalesceSqlFunction, ConcatSqlFunction, ContainsKeySqlFunction, CurrentDateSqlFunction, CurrentTimeSqlFunction, CurrentUserSqlFunction, DateAddSqlFunction, DayNameSqlFunction, DayOfMonthSqlFunction, DayOfWeekSqlFunction, DayOfYearSqlFunction, DivideSqlFunction, ExtractSqlFunction, FloorSqlFunction, GetDateSqlFunction, HourSqlFunction, InStrSqlFunction, LeftSqlFunction, LnSqlFunction, Log10SqlFunction, LogSqlFunction, LowerSqlFunction, MinusSqlFunction, MinuteSqlFunction, ModSqlFunction, MonthNameSqlFunction, MonthSqlFunction, MultiplySqlFunction, OdbcTimestampSqlFunction, PgGetExprSqlFunction, PlusSqlFunction, PowerSqlFunction, QuarterSqlFunction, RandomSqlFunction, RepeatSqlFunction, ReplaceSqlFunction, RightSqlFunction, RoundSqlFunction, SecondSqlFunction, StrposFunction, SubstringSqlFunction, SubstrSqlFunction, SysDateSqlFunction, ToCharSqlFunction, ToNumberSqlFunction, TruncSqlFunction, UnsupportedSqlFunction, UpperSqlFunction, WeekSqlFunction, YearSqlFunction
Defines a routine, to be use in SQLQuery context, that accepts arguments and performs an action
on the stored object, such as a complex calculation.
- Since:
- 11.0
- Author:
- Barak Bar Orion
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Objectapply(SqlFunctionExecutionContext context) Defines the action to be performed on the stored object.protected voidassertNumberOfArguments(int minExpected, int maxExpected, SqlFunctionExecutionContext context) Validate the number of arguments a function receives is in a given range.protected voidassertNumberOfArguments(int expected, SqlFunctionExecutionContext context) Validate the number of arguments a function receives.protected Class<?> fromSqlTypeName(String sqlTypeName, Class<?> def) protected booleanprotected booleanisWholeNumber(Object object)
-
Constructor Details
-
SqlFunction
public SqlFunction()
-
-
Method Details
-
apply
Defines the action to be performed on the stored object.- Parameters:
context- contains the arguments,SqlFunctionExecutionContext- Returns:
- The Stored object after applying the action
- Throws:
RuntimeException- if wrong input arguments were supplied
-
assertNumberOfArguments
Validate the number of arguments a function receives.- Parameters:
expected- number of arguments, according to every function inner logic.context- the actual received arguments, which are contained in the context.- Throws:
RuntimeException- if expected doesn't match actual number of arguments in context
-
assertNumberOfArguments
protected void assertNumberOfArguments(int minExpected, int maxExpected, SqlFunctionExecutionContext context) Validate the number of arguments a function receives is in a given range.- Parameters:
minExpected- minimum number of arguments, according to every function inner logic.maxExpected- maximum number of arguments, according to every function inner logic.context- the actual received arguments, which are contained in the context.- Throws:
RuntimeException- if expected doesn't match actual number of arguments in context
-
isWholeNumber
-
isString
-
fromSqlTypeName
-