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

public abstract class SqlFunction extends Object
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 Details

    • SqlFunction

      public SqlFunction()
  • Method Details

    • apply

      public abstract Object apply(SqlFunctionExecutionContext context)
      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

      protected void assertNumberOfArguments(int expected, SqlFunctionExecutionContext context)
      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

      protected boolean isWholeNumber(Object object)
    • isString

      protected boolean isString(Object object)
    • fromSqlTypeName

      protected Class<?> fromSqlTypeName(String sqlTypeName, Class<?> def)