use of com.blazebit.persistence.impl.function.jsonset.OracleJsonSetFunction in project blaze-persistence by Blazebit.
the class CriteriaBuilderConfigurationImpl method loadFunctions.
// NOTE: When adding a function here, you might want to also add it in AbstractCoreTest so it is recognized
@SuppressWarnings("checkstyle:methodlength")
private void loadFunctions() {
JpqlFunctionGroup jpqlFunctionGroup;
// limit
jpqlFunctionGroup = new JpqlFunctionGroup(LimitFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new LimitFunction(dbmsDialects.get(null)));
jpqlFunctionGroup.add("mysql", new LimitFunction(dbmsDialects.get("mysql")));
jpqlFunctionGroup.add("mysql8", new LimitFunction(dbmsDialects.get("mysql8")));
jpqlFunctionGroup.add("oracle", new LimitFunction(dbmsDialects.get("oracle")));
jpqlFunctionGroup.add("db2", new LimitFunction(dbmsDialects.get("db2")));
// Does not support limit
jpqlFunctionGroup.add("sybase", null);
jpqlFunctionGroup.add("microsoft", new LimitFunction(dbmsDialects.get("microsoft")));
registerFunction(jpqlFunctionGroup);
// page_position
jpqlFunctionGroup = new JpqlFunctionGroup(PagePositionFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new PagePositionFunction());
jpqlFunctionGroup.add("mysql", new MySQLPagePositionFunction());
jpqlFunctionGroup.add("mysql8", new MySQLPagePositionFunction());
jpqlFunctionGroup.add("oracle", new OraclePagePositionFunction());
jpqlFunctionGroup.add("sybase", new TransactSQLPagePositionFunction());
jpqlFunctionGroup.add("microsoft", new TransactSQLPagePositionFunction());
registerFunction(jpqlFunctionGroup);
// entity_function
registerFunction(EntityFunction.FUNCTION_NAME, new EntityFunction());
// nullfn
registerFunction(NullfnFunction.FUNCTION_NAME, new NullfnFunction());
// collection_dml_support
registerFunction(CollectionDmlSupportFunction.FUNCTION_NAME, new CollectionDmlSupportFunction());
// param
registerFunction(ParamFunction.FUNCTION_NAME, new ParamFunction());
// exist
registerFunction(ExistFunction.FUNCTION_NAME, new ExistFunction());
// replace
registerFunction(ReplaceFunction.FUNCTION_NAME, new ReplaceFunction());
// chr
jpqlFunctionGroup = new JpqlFunctionGroup(ChrFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new ChrFunction());
jpqlFunctionGroup.add("mysql", new CharChrFunction());
jpqlFunctionGroup.add("mysql8", new CharChrFunction());
jpqlFunctionGroup.add("microsoft", new CharChrFunction());
jpqlFunctionGroup.add("sybase", new CharChrFunction());
registerFunction(jpqlFunctionGroup);
// base64
jpqlFunctionGroup = new JpqlFunctionGroup(Base64Function.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new Base64Function());
jpqlFunctionGroup.add("postgresql", new PostgreSQLBase64Function());
registerFunction(jpqlFunctionGroup);
for (SetOperationType setType : SetOperationType.values()) {
// Use a prefix because hibernate uses UNION as keyword
jpqlFunctionGroup = new JpqlFunctionGroup("set_" + setType.name().toLowerCase(), false);
for (Map.Entry<String, DbmsDialect> dbmsDialectEntry : dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dbmsDialectEntry.getKey(), new SetFunction(setType, dbmsDialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
}
// temporal literals
registerFunction(LiteralTimeFunction.FUNCTION_NAME, new LiteralTimeFunction());
registerFunction(LiteralDateFunction.FUNCTION_NAME, new LiteralDateFunction());
registerFunction(LiteralTimestampFunction.FUNCTION_NAME, new LiteralTimestampFunction());
registerFunction(LiteralDateTimestampFunction.FUNCTION_NAME, new LiteralDateTimestampFunction());
registerFunction(LiteralCalendarFunction.FUNCTION_NAME, new LiteralCalendarFunction());
// treat
registerNamedType("Boolean", Boolean.class);
registerNamedType("Byte", Byte.class);
registerNamedType("Short", Short.class);
registerNamedType("Integer", Integer.class);
registerNamedType("Long", Long.class);
registerNamedType("Float", Float.class);
registerNamedType("Double", Double.class);
registerNamedType("Character", Character.class);
registerNamedType("String", String.class);
registerNamedType("BigInteger", BigInteger.class);
registerNamedType("BigDecimal", BigDecimal.class);
registerNamedType("Time", Time.class);
registerNamedType("Date", java.sql.Date.class);
registerNamedType("Timestamp", Timestamp.class);
registerNamedType("TimeZone", TimeZone.class);
registerNamedType("Calendar", Calendar.class);
registerNamedType("GregorianCalendar", GregorianCalendar.class);
registerNamedType("Class", java.lang.Class.class);
registerNamedType("Currency", java.util.Currency.class);
registerNamedType("Locale", java.util.Locale.class);
registerNamedType("UUID", java.util.UUID.class);
registerNamedType("URL", java.net.URL.class);
// Java 8 time types
try {
registerNamedType("LocalDate", Class.forName("java.time.LocalDate"));
registerNamedType("LocalTime", Class.forName("java.time.LocalTime"));
registerNamedType("LocalDateTime", Class.forName("java.time.LocalDateTime"));
registerNamedType("OffsetTime", Class.forName("java.time.OffsetTime"));
registerNamedType("OffsetDateTime", Class.forName("java.time.OffsetDateTime"));
registerNamedType("ZonedDateTime", Class.forName("java.time.ZonedDateTime"));
registerNamedType("Duration", Class.forName("java.time.Duration"));
registerNamedType("Instant", Class.forName("java.time.Instant"));
registerNamedType("MonthDay", Class.forName("java.time.MonthDay"));
registerNamedType("Year", Class.forName("java.time.Year"));
registerNamedType("YearMonth", Class.forName("java.time.YearMonth"));
registerNamedType("Period", Class.forName("java.time.Period"));
registerNamedType("ZoneId", Class.forName("java.time.ZoneId"));
registerNamedType("ZoneOffset", Class.forName("java.time.ZoneOffset"));
registerFunction(LiteralLocalDateFunction.FUNCTION_NAME, new LiteralLocalDateFunction());
registerFunction(LiteralLocalTimeFunction.FUNCTION_NAME, new LiteralLocalTimeFunction());
registerFunction(LiteralLocalDateTimeFunction.FUNCTION_NAME, new LiteralLocalDateTimeFunction());
registerFunction(LiteralInstantFunction.FUNCTION_NAME, new LiteralInstantFunction());
registerFunction(LiteralZonedDateTimeFunction.FUNCTION_NAME, new LiteralZonedDateTimeFunction());
registerFunction(LiteralOffsetTimeFunction.FUNCTION_NAME, new LiteralOffsetTimeFunction());
registerFunction(LiteralOffsetDateTimeFunction.FUNCTION_NAME, new LiteralOffsetDateTimeFunction());
} catch (ClassNotFoundException ex) {
// If they aren't found, we ignore them
}
// cast
registerFunction(new JpqlFunctionGroup("cast_boolean"));
registerFunction(new JpqlFunctionGroup("cast_byte"));
registerFunction(new JpqlFunctionGroup("cast_short"));
registerFunction(new JpqlFunctionGroup("cast_integer"));
registerFunction(new JpqlFunctionGroup("cast_long"));
registerFunction(new JpqlFunctionGroup("cast_float"));
registerFunction(new JpqlFunctionGroup("cast_double"));
registerFunction(new JpqlFunctionGroup("cast_character"));
registerFunction(new JpqlFunctionGroup("cast_string"));
registerFunction(new JpqlFunctionGroup("cast_biginteger"));
registerFunction(new JpqlFunctionGroup("cast_bigdecimal"));
registerFunction(new JpqlFunctionGroup("cast_time"));
registerFunction(new JpqlFunctionGroup("cast_date"));
registerFunction(new JpqlFunctionGroup("cast_timestamp"));
registerFunction(new JpqlFunctionGroup("cast_calendar"));
for (Map.Entry<String, DbmsDialect> dbmsDialectEntry : dbmsDialects.entrySet()) {
for (Class<?> type : BasicCastTypes.TYPES) {
CastFunction castFunction;
if ("db2".equals(dbmsDialectEntry.getKey())) {
castFunction = new DB2CastFunction(type, dbmsDialectEntry.getValue());
} else {
castFunction = new CastFunction(type, dbmsDialectEntry.getValue());
}
functions.get("cast_" + type.getSimpleName().toLowerCase()).add(dbmsDialectEntry.getKey(), castFunction);
}
}
// concat
jpqlFunctionGroup = new JpqlFunctionGroup(ConcatFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, PipeBasedConcatFunction.INSTANCE);
jpqlFunctionGroup.add("mysql", ConcatFunction.INSTANCE);
jpqlFunctionGroup.add("mysql8", ConcatFunction.INSTANCE);
jpqlFunctionGroup.add("microsoft", PlusBasedConcatFunction.INSTANCE);
jpqlFunctionGroup.add("sybase", PlusBasedConcatFunction.INSTANCE);
registerFunction(jpqlFunctionGroup);
// group_concat
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractGroupConcatFunction.FUNCTION_NAME, true);
jpqlFunctionGroup.add("db2", new DB2GroupConcatFunction());
jpqlFunctionGroup.add("oracle", new OracleListaggGroupConcatFunction());
jpqlFunctionGroup.add("h2", new H2GroupConcatFunction());
jpqlFunctionGroup.add("mysql", new MySQLGroupConcatFunction());
jpqlFunctionGroup.add("mysql8", new MySQLGroupConcatFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLGroupConcatFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLGroupConcatFunction());
registerFunction(jpqlFunctionGroup);
// listagg
jpqlFunctionGroup = new JpqlFunctionGroup("listagg", JpqlFunctionKind.ORDERED_SET_AGGREGATE);
jpqlFunctionGroup.add("db2", new DB2GroupConcatWindowFunction(dbmsDialects.get("db2")));
jpqlFunctionGroup.add("oracle", new OracleListaggGroupConcatWindowFunction(dbmsDialects.get("oracle")));
jpqlFunctionGroup.add("h2", new H2GroupConcatWindowFunction(dbmsDialects.get("h2")));
jpqlFunctionGroup.add("mysql", new MySQLGroupConcatWindowFunction(dbmsDialects.get("mysql")));
jpqlFunctionGroup.add("mysql8", new MySQLGroupConcatWindowFunction(dbmsDialects.get("mysql8")));
jpqlFunctionGroup.add("microsoft", new MSSQLGroupConcatFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLGroupConcatWindowFunction(dbmsDialects.get("postgresql")));
registerFunction(jpqlFunctionGroup);
// window_group_concat
jpqlFunctionGroup = new JpqlFunctionGroup("window_group_concat", JpqlFunctionKind.WINDOW);
jpqlFunctionGroup.add("db2", new DB2GroupConcatWindowFunction(dbmsDialects.get("db2")));
jpqlFunctionGroup.add("oracle", new OracleListaggGroupConcatWindowFunction(dbmsDialects.get("oracle")));
jpqlFunctionGroup.add("h2", new H2GroupConcatWindowFunction(dbmsDialects.get("h2")));
jpqlFunctionGroup.add("mysql", new MySQLGroupConcatWindowFunction(dbmsDialects.get("mysql")));
jpqlFunctionGroup.add("mysql8", new MySQLGroupConcatWindowFunction(dbmsDialects.get("mysql8")));
jpqlFunctionGroup.add("postgresql", new PostgreSQLGroupConcatWindowFunction(dbmsDialects.get("postgresql")));
registerFunction(jpqlFunctionGroup);
// datetime
jpqlFunctionGroup = new JpqlFunctionGroup("year", false);
jpqlFunctionGroup.add(null, new YearFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLYearFunction());
jpqlFunctionGroup.add("access", new AccessYearFunction());
jpqlFunctionGroup.add("db2", new DB2YearFunction());
jpqlFunctionGroup.add("derby", new DerbyYearFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLYearFunction());
jpqlFunctionGroup.add("sybase", new SybaseYearFunction());
jpqlFunctionGroup.add("sqlite", new SqliteYearFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("year_of_week", false);
jpqlFunctionGroup.add(null, new YearOfWeekFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLYearOfWeekFunction());
jpqlFunctionGroup.add("db2", new DB2YearOfWeekFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLYearOfWeekFunction());
jpqlFunctionGroup.add("mysql", new MySQLYearOfWeekFunction());
jpqlFunctionGroup.add("mysql8", new MySQLYearOfWeekFunction());
jpqlFunctionGroup.add("oracle", new OracleYearOfWeekFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("year_week", false);
jpqlFunctionGroup.add(null, new YearWeekFunction());
jpqlFunctionGroup.add("mysql", new MySQLYearWeekFunction());
jpqlFunctionGroup.add("mysql8", new MySQLYearWeekFunction());
jpqlFunctionGroup.add("db2", new DB2YearWeekFunction());
jpqlFunctionGroup.add("oracle", new OracleYearWeekFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLYearWeekFunction());
jpqlFunctionGroup.add("h2", new H2YearWeekFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLYearWeekFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("month", false);
jpqlFunctionGroup.add(null, new MonthFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMonthFunction());
jpqlFunctionGroup.add("access", new AccessMonthFunction());
jpqlFunctionGroup.add("db2", new DB2MonthFunction());
jpqlFunctionGroup.add("derby", new DerbyMonthFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMonthFunction());
jpqlFunctionGroup.add("sybase", new SybaseMonthFunction());
jpqlFunctionGroup.add("sqlite", new SqliteMonthFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("week", false);
jpqlFunctionGroup.add(null, new IsoWeekFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLIsoWeekFunction());
jpqlFunctionGroup.add("access", new AccessIsoWeekFunction());
jpqlFunctionGroup.add("db2", new DB2IsoWeekFunction());
jpqlFunctionGroup.add("h2", new H2IsoWeekFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLIsoWeekFunction());
jpqlFunctionGroup.add("sybase", new SybaseIsoWeekFunction());
jpqlFunctionGroup.add("sqlite", new SqliteIsoWeekFunction());
jpqlFunctionGroup.add("mysql", new MySQLIsoWeekFunction());
jpqlFunctionGroup.add("mysql8", new MySQLIsoWeekFunction());
jpqlFunctionGroup.add("oracle", new OracleIsoWeekFunction());
jpqlFunctionGroup.add("sqlite", new SqliteIsoWeekFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("iso_week", false);
jpqlFunctionGroup.add(null, new IsoWeekFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLIsoWeekFunction());
jpqlFunctionGroup.add("access", new AccessIsoWeekFunction());
jpqlFunctionGroup.add("db2", new DB2IsoWeekFunction());
jpqlFunctionGroup.add("h2", new H2IsoWeekFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLIsoWeekFunction());
jpqlFunctionGroup.add("sybase", new SybaseIsoWeekFunction());
jpqlFunctionGroup.add("sqlite", new SqliteIsoWeekFunction());
jpqlFunctionGroup.add("mysql", new MySQLIsoWeekFunction());
jpqlFunctionGroup.add("mysql8", new MySQLIsoWeekFunction());
jpqlFunctionGroup.add("oracle", new OracleIsoWeekFunction());
jpqlFunctionGroup.add("sqlite", new SqliteIsoWeekFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("week_in_year", false);
jpqlFunctionGroup.add(null, new WeekInYearFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLWeekInYearFunction());
jpqlFunctionGroup.add("db2", new DB2WeekInYearFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLWeekInYearFunction());
jpqlFunctionGroup.add("mysql", new MySQLWeekInYearFunction());
jpqlFunctionGroup.add("mysql8", new MySQLWeekInYearFunction());
jpqlFunctionGroup.add("oracle", new OracleWeekInYearFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("quarter", false);
jpqlFunctionGroup.add(null, new QuarterFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLQuarterFunction());
jpqlFunctionGroup.add("access", new AccessQuarterFunction());
jpqlFunctionGroup.add("db2", new DB2QuarterFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLQuarterFunction());
jpqlFunctionGroup.add("sybase", new SybaseQuarterFunction());
jpqlFunctionGroup.add("sqlite", new SqliteQuarterFunction());
jpqlFunctionGroup.add("oracle", new OracleQuarterFunction());
jpqlFunctionGroup.add("sqlite", new SqliteQuarterFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("day", false);
jpqlFunctionGroup.add(null, new DayFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLDayFunction());
jpqlFunctionGroup.add("access", new AccessDayFunction());
jpqlFunctionGroup.add("db2", new DB2DayFunction());
jpqlFunctionGroup.add("derby", new DerbyDayFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLDayFunction());
jpqlFunctionGroup.add("sybase", new SybaseDayFunction());
jpqlFunctionGroup.add("sqlite", new SqliteDayFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("dayofyear", false);
jpqlFunctionGroup.add(null, new DayOfYearFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLDayOfYearFunction());
jpqlFunctionGroup.add("access", new AccessDayOfYearFunction());
jpqlFunctionGroup.add("db2", new DB2DayOfYearFunction());
jpqlFunctionGroup.add("mysql", new MySQLDayOfYearFunction());
jpqlFunctionGroup.add("mysql8", new MySQLDayOfYearFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLDayOfYearFunction());
jpqlFunctionGroup.add("sybase", new SybaseDayOfYearFunction());
jpqlFunctionGroup.add("oracle", new OracleDayOfYearFunction());
jpqlFunctionGroup.add("sqlite", new SqliteDayOfYearFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("dayofweek", false);
jpqlFunctionGroup.add(null, new DayOfWeekFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLDayOfWeekFunction());
jpqlFunctionGroup.add("access", new AccessDayOfWeekFunction());
jpqlFunctionGroup.add("db2", new DB2DayOfWeekFunction());
jpqlFunctionGroup.add("mysql", new MySQLDayOfWeekFunction());
jpqlFunctionGroup.add("mysql8", new MySQLDayOfWeekFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLDayOfWeekFunction());
jpqlFunctionGroup.add("sybase", new SybaseDayOfWeekFunction());
jpqlFunctionGroup.add("oracle", new OracleDayOfWeekFunction());
jpqlFunctionGroup.add("sqlite", new SqliteDayOfWeekFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("isodayofweek", false);
jpqlFunctionGroup.add(null, new IsoDayOfWeekFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLIsoDayOfWeekFunction());
jpqlFunctionGroup.add("access", new AccessIsoDayOfWeekFunction());
jpqlFunctionGroup.add("db2", new DB2IsoDayOfWeekFunction());
jpqlFunctionGroup.add("mysql", new MySQLIsoDayOfWeekFunction());
jpqlFunctionGroup.add("mysql8", new MySQLIsoDayOfWeekFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLIsoDayOfWeekFunction());
jpqlFunctionGroup.add("sybase", new SybaseIsoDayOfWeekFunction());
jpqlFunctionGroup.add("oracle", new OracleIsoDayOfWeekFunction());
jpqlFunctionGroup.add("sqlite", new SqliteIsoDayOfWeekFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("hour", false);
jpqlFunctionGroup.add(null, new HourFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLHourFunction());
jpqlFunctionGroup.add("access", new AccessHourFunction());
jpqlFunctionGroup.add("db2", new DB2HourFunction());
jpqlFunctionGroup.add("derby", new DerbyHourFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLHourFunction());
jpqlFunctionGroup.add("sybase", new SybaseHourFunction());
jpqlFunctionGroup.add("oracle", new OracleHourFunction());
jpqlFunctionGroup.add("sqlite", new SqliteHourFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("minute", false);
jpqlFunctionGroup.add(null, new MinuteFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMinuteFunction());
jpqlFunctionGroup.add("access", new AccessMinuteFunction());
jpqlFunctionGroup.add("db2", new DB2MinuteFunction());
jpqlFunctionGroup.add("derby", new DerbyMinuteFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMinuteFunction());
jpqlFunctionGroup.add("sybase", new SybaseMinuteFunction());
jpqlFunctionGroup.add("oracle", new OracleMinuteFunction());
jpqlFunctionGroup.add("sqlite", new SqliteMinuteFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("second", false);
jpqlFunctionGroup.add(null, new SecondFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLSecondFunction());
jpqlFunctionGroup.add("access", new AccessSecondFunction());
jpqlFunctionGroup.add("db2", new DB2SecondFunction());
jpqlFunctionGroup.add("derby", new DerbySecondFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLSecondFunction());
jpqlFunctionGroup.add("sybase", new SybaseSecondFunction());
jpqlFunctionGroup.add("oracle", new OracleSecondFunction());
jpqlFunctionGroup.add("sqlite", new SqliteSecondFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("millisecond", false);
jpqlFunctionGroup.add(null, new MillisecondFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMillisecondFunction());
jpqlFunctionGroup.add("db2", new DB2MillisecondFunction());
jpqlFunctionGroup.add("mysql", new MySQLMillisecondFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMillisecondFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMillisecondFunction());
jpqlFunctionGroup.add("sybase", new SybaseMillisecondFunction());
jpqlFunctionGroup.add("oracle", new OracleMillisecondFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("microsecond", false);
jpqlFunctionGroup.add(null, new MicrosecondFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMicrosecondFunction());
jpqlFunctionGroup.add("db2", new DB2MicrosecondFunction());
jpqlFunctionGroup.add("mysql", new MySQLMicrosecondFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMicrosecondFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMicrosecondFunction());
jpqlFunctionGroup.add("sybase", new SybaseMicrosecondFunction());
jpqlFunctionGroup.add("oracle", new OracleMicrosecondFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("epoch", false);
jpqlFunctionGroup.add(null, new DefaultEpochFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLEpochFunction());
jpqlFunctionGroup.add("oracle", new OracleEpochFunction());
jpqlFunctionGroup.add("db2", new DB2EpochFunction());
jpqlFunctionGroup.add("mysql", new MySQLEpochFunction());
jpqlFunctionGroup.add("mysql8", new MySQLEpochFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("epoch_seconds", false);
jpqlFunctionGroup.add(null, new DefaultEpochFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLEpochFunction());
jpqlFunctionGroup.add("oracle", new OracleEpochFunction());
jpqlFunctionGroup.add("db2", new DB2EpochFunction());
jpqlFunctionGroup.add("mysql", new MySQLEpochFunction());
jpqlFunctionGroup.add("mysql8", new MySQLEpochFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("epoch_days", false);
jpqlFunctionGroup.add(null, new DefaultEpochDayFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLEpochDayFunction());
jpqlFunctionGroup.add("oracle", new OracleEpochDayFunction());
jpqlFunctionGroup.add("db2", new DB2EpochDayFunction());
jpqlFunctionGroup.add("mysql", new MySQLEpochDayFunction());
jpqlFunctionGroup.add("mysql8", new MySQLEpochDayFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("epoch_milliseconds", false);
jpqlFunctionGroup.add(null, new DefaultEpochMillisecondFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLEpochMillisecondFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLEpochMillisecondFunction());
jpqlFunctionGroup.add("oracle", new OracleEpochMillisecondFunction());
jpqlFunctionGroup.add("db2", new DB2EpochMillisecondFunction());
jpqlFunctionGroup.add("mysql", new MySQLEpochMillisecondFunction());
jpqlFunctionGroup.add("mysql8", new MySQLEpochMillisecondFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("epoch_microseconds", false);
jpqlFunctionGroup.add(null, new DefaultEpochMicrosecondFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLEpochMicrosecondFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLEpochMicrosecondFunction());
jpqlFunctionGroup.add("oracle", new OracleEpochMicrosecondFunction());
jpqlFunctionGroup.add("db2", new DB2EpochMicrosecondFunction());
jpqlFunctionGroup.add("mysql", new MySQLEpochMicrosecondFunction());
jpqlFunctionGroup.add("mysql8", new MySQLEpochMicrosecondFunction());
registerFunction(jpqlFunctionGroup);
// dateadd
jpqlFunctionGroup = new JpqlFunctionGroup(DayAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new DayAddFunction());
jpqlFunctionGroup.add("db2", new DB2DayAddFunction());
jpqlFunctionGroup.add("h2", new H2DayAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLDayAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLDayAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLDayAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLDayAddFunction());
jpqlFunctionGroup.add("oracle", new OracleDayAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(HourAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new HourAddFunction());
jpqlFunctionGroup.add("db2", new DB2HourAddFunction());
jpqlFunctionGroup.add("h2", new H2HourAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLHourAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLHourAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLHourAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLHourAddFunction());
jpqlFunctionGroup.add("oracle", new OracleHourAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(MicrosecondsAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new MicrosecondsAddFunction());
jpqlFunctionGroup.add("db2", new DB2MicrosecondsAddFunction());
jpqlFunctionGroup.add("h2", new H2MicrosecondsAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMicrosecondsAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLMicrosecondsAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMicrosecondsAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMicrosecondsAddFunction());
jpqlFunctionGroup.add("oracle", new OracleMicrosecondsAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(MillisecondsAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new MillisecondsAddFunction());
jpqlFunctionGroup.add("db2", new DB2MillisecondsAddFunction());
jpqlFunctionGroup.add("h2", new H2MillisecondsAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMillisecondsAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLMillisecondsAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMillisecondsAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMillisecondsAddFunction());
jpqlFunctionGroup.add("oracle", new OracleMillisecondsAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(MinuteAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new MinuteAddFunction());
jpqlFunctionGroup.add("db2", new DB2MinuteAddFunction());
jpqlFunctionGroup.add("h2", new H2MinuteAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMinuteAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLMinuteAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMinuteAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMinuteAddFunction());
jpqlFunctionGroup.add("oracle", new OracleMinuteAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(MonthAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new MonthAddFunction());
jpqlFunctionGroup.add("db2", new DB2MonthAddFunction());
jpqlFunctionGroup.add("h2", new H2MonthAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMonthAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLMonthAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMonthAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMonthAddFunction());
jpqlFunctionGroup.add("oracle", new OracleMonthAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(QuarterAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new QuarterAddFunction());
jpqlFunctionGroup.add("db2", new DB2QuarterAddFunction());
jpqlFunctionGroup.add("h2", new H2QuarterAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLQuarterAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLQuarterAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLQuarterAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLQuarterAddFunction());
jpqlFunctionGroup.add("oracle", new OracleQuarterAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(SecondAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new SecondAddFunction());
jpqlFunctionGroup.add("db2", new DB2SecondAddFunction());
jpqlFunctionGroup.add("h2", new H2SecondAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLSecondAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLSecondAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLSecondAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLSecondAddFunction());
jpqlFunctionGroup.add("oracle", new OracleSecondAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(WeekAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new WeekAddFunction());
jpqlFunctionGroup.add("db2", new DB2WeekAddFunction());
jpqlFunctionGroup.add("h2", new H2WeekAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLWeekAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLWeekAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLWeekAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLWeekAddFunction());
jpqlFunctionGroup.add("oracle", new OracleWeekAddFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(YearAddFunction.NAME, false);
jpqlFunctionGroup.add(null, new YearAddFunction());
jpqlFunctionGroup.add("db2", new DB2YearAddFunction());
jpqlFunctionGroup.add("h2", new H2YearAddFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLYearAddFunction());
jpqlFunctionGroup.add("mysql", new MySQLYearAddFunction());
jpqlFunctionGroup.add("mysql8", new MySQLYearAddFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLYearAddFunction());
jpqlFunctionGroup.add("oracle", new OracleYearAddFunction());
registerFunction(jpqlFunctionGroup);
// datediff
jpqlFunctionGroup = new JpqlFunctionGroup("year_diff", false);
jpqlFunctionGroup.add("access", new AccessYearDiffFunction());
jpqlFunctionGroup.add("db2", new DB2YearDiffFunction());
jpqlFunctionGroup.add("h2", new DefaultYearDiffFunction());
jpqlFunctionGroup.add("microsoft", new DefaultYearDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLYearDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLYearDiffFunction());
jpqlFunctionGroup.add("sybase", new DefaultYearDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLYearDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleYearDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("month_diff", false);
jpqlFunctionGroup.add("access", new AccessMonthDiffFunction());
jpqlFunctionGroup.add("db2", new DB2MonthDiffFunction());
jpqlFunctionGroup.add("h2", new DefaultMonthDiffFunction());
jpqlFunctionGroup.add("microsoft", new DefaultMonthDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLMonthDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMonthDiffFunction());
jpqlFunctionGroup.add("sybase", new DefaultMonthDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMonthDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleMonthDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("day_diff", false);
jpqlFunctionGroup.add("access", new AccessDayDiffFunction());
jpqlFunctionGroup.add("db2", new DB2DayDiffFunction());
jpqlFunctionGroup.add("h2", new DefaultDayDiffFunction());
jpqlFunctionGroup.add("microsoft", new DefaultDayDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLDayDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLDayDiffFunction());
jpqlFunctionGroup.add("sybase", new DefaultDayDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLDayDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleDayDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("hour_diff", false);
jpqlFunctionGroup.add("access", new AccessHourDiffFunction());
jpqlFunctionGroup.add("db2", new DB2HourDiffFunction());
jpqlFunctionGroup.add("h2", new DefaultHourDiffFunction());
jpqlFunctionGroup.add("microsoft", new DefaultHourDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLHourDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLHourDiffFunction());
jpqlFunctionGroup.add("sybase", new DefaultHourDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLHourDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleHourDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("minute_diff", false);
jpqlFunctionGroup.add("access", new AccessMinuteDiffFunction());
jpqlFunctionGroup.add("db2", new DB2MinuteDiffFunction());
jpqlFunctionGroup.add("h2", new DefaultMinuteDiffFunction());
jpqlFunctionGroup.add("microsoft", new DefaultMinuteDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLMinuteDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMinuteDiffFunction());
jpqlFunctionGroup.add("sybase", new DefaultMinuteDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMinuteDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleMinuteDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("second_diff", false);
jpqlFunctionGroup.add(null, new DefaultSecondDiffFunction());
jpqlFunctionGroup.add("access", new AccessSecondDiffFunction());
jpqlFunctionGroup.add("db2", new DB2SecondDiffFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLSecondDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLSecondDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLSecondDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLSecondDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleSecondDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("epoch_diff", false);
jpqlFunctionGroup.add(null, new DefaultSecondDiffFunction());
jpqlFunctionGroup.add("access", new AccessSecondDiffFunction());
jpqlFunctionGroup.add("db2", new DB2SecondDiffFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLSecondDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLSecondDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLSecondDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLSecondDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleSecondDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("millisecond_diff", false);
jpqlFunctionGroup.add(null, new DefaultMillisecondDiffFunction());
jpqlFunctionGroup.add("access", new AccessMillisecondDiffFunction());
jpqlFunctionGroup.add("db2", new DB2MillisecondDiffFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMillisecondDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLMillisecondDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMillisecondDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMillisecondDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleMillisecondDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("microsecond_diff", false);
jpqlFunctionGroup.add(null, new DefaultMicrosecondDiffFunction());
jpqlFunctionGroup.add("access", new AccessMicrosecondDiffFunction());
jpqlFunctionGroup.add("db2", new DB2MicrosecondDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLMicrosecondDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLMicrosecondDiffFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLMicrosecondDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLMicrosecondDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleMicrosecondDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("week_diff", false);
jpqlFunctionGroup.add(null, new DefaultWeekDiffFunction());
jpqlFunctionGroup.add("h2", new H2WeekDiffFunction());
jpqlFunctionGroup.add("db2", new DB2WeekDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLWeekDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLWeekDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLWeekDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleWeekDiffFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLWeekDiffFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("quarter_diff", false);
jpqlFunctionGroup.add(null, new DefaultQuarterDiffFunction());
jpqlFunctionGroup.add("access", new AccessQuarterDiffFunction());
jpqlFunctionGroup.add("h2", new H2QuarterDiffFunction());
jpqlFunctionGroup.add("db2", new DB2QuarterDiffFunction());
jpqlFunctionGroup.add("mysql", new MySQLQuarterDiffFunction());
jpqlFunctionGroup.add("mysql8", new MySQLQuarterDiffFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLQuarterDiffFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLQuarterDiffFunction());
jpqlFunctionGroup.add("oracle", new OracleQuarterDiffFunction());
registerFunction(jpqlFunctionGroup);
// date trunc
jpqlFunctionGroup = new JpqlFunctionGroup(TruncDayFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncDayFunction());
jpqlFunctionGroup.add("db2", new DB2TruncDayFunction());
jpqlFunctionGroup.add("h2", new H2TruncDayFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncDayFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncDayFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncDayFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncDayFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncDayFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncHourFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncHourFunction());
jpqlFunctionGroup.add("db2", new DB2TruncHourFunction());
jpqlFunctionGroup.add("h2", new H2TruncHourFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncHourFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncHourFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncHourFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncHourFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncHourFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncMicrosecondsFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncMicrosecondsFunction());
jpqlFunctionGroup.add("db2", new DB2TruncMicrosecondsFunction());
jpqlFunctionGroup.add("h2", new H2TruncMicrosecondsFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncMicrosecondsFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncMicrosecondsFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncMicrosecondsFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncMicrosecondsFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncMicrosecondsFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncMillisecondsFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncMillisecondsFunction());
jpqlFunctionGroup.add("db2", new DB2TruncMillisecondsFunction());
jpqlFunctionGroup.add("h2", new H2TruncMillisecondsFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncMillisecondsFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncMillisecondsFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncMillisecondsFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncMillisecondsFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncMillisecondsFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncMinuteFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncMinuteFunction());
jpqlFunctionGroup.add("db2", new DB2TruncMinuteFunction());
jpqlFunctionGroup.add("h2", new H2TruncMinuteFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncMinuteFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncMinuteFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncMinuteFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncMinuteFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncMinuteFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncMonthFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncMonthFunction());
jpqlFunctionGroup.add("db2", new DB2TruncMonthFunction());
jpqlFunctionGroup.add("h2", new H2TruncMonthFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncMonthFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncMonthFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncMonthFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncMonthFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncMonthFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncQuarterFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncQuarterFunction());
jpqlFunctionGroup.add("db2", new DB2TruncQuarterFunction());
jpqlFunctionGroup.add("h2", new H2TruncQuarterFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncQuarterFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncQuarterFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncQuarterFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncQuarterFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncQuarterFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncSecondFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncSecondFunction());
jpqlFunctionGroup.add("db2", new DB2TruncSecondFunction());
jpqlFunctionGroup.add("h2", new H2TruncSecondFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncSecondFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncSecondFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncSecondFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncSecondFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncSecondFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncWeekFunction.NAME, false);
jpqlFunctionGroup.add(null, new TruncWeekFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncWeekFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncWeekFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncWeekFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncWeekFunction());
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup(TruncYearFunction.NAME, false);
jpqlFunctionGroup.add(null, new PostgreSQLTruncYearFunction());
jpqlFunctionGroup.add("db2", new DB2TruncYearFunction());
jpqlFunctionGroup.add("h2", new H2TruncYearFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLTruncYearFunction());
jpqlFunctionGroup.add("mysql", new MySQLTruncYearFunction());
jpqlFunctionGroup.add("mysql8", new MySQLTruncYearFunction());
jpqlFunctionGroup.add("oracle", new OracleTruncYearFunction());
jpqlFunctionGroup.add("postgresql", new PostgreSQLTruncYearFunction());
registerFunction(jpqlFunctionGroup);
// count
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractCountFunction.FUNCTION_NAME, true);
jpqlFunctionGroup.add(null, new CountTupleFunction());
jpqlFunctionGroup.add("mysql", new MySQLCountTupleFunction());
jpqlFunctionGroup.add("mysql8", new MySQLCountTupleFunction());
jpqlFunctionGroup.add("db2", new CountTupleEmulationFunction());
jpqlFunctionGroup.add("microsoft", new CountTupleEmulationFunction("+", "varchar(max)"));
jpqlFunctionGroup.add("oracle", new CountTupleEmulationFunction());
jpqlFunctionGroup.add("hsql", new CountTupleEmulationFunction());
registerFunction(jpqlFunctionGroup);
// row values
jpqlFunctionGroup = new JpqlFunctionGroup(RowValueComparisonFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new RowValueComparisonFunction());
registerFunction(jpqlFunctionGroup);
// row values subquery
jpqlFunctionGroup = new JpqlFunctionGroup(RowValueSubqueryComparisonFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new RowValueSubqueryComparisonFunction());
registerFunction(jpqlFunctionGroup);
// alias function
jpqlFunctionGroup = new JpqlFunctionGroup(AliasFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new AliasFunction());
registerFunction(jpqlFunctionGroup);
// column trunc function
jpqlFunctionGroup = new JpqlFunctionGroup(ColumnTruncFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new ColumnTruncFunction());
registerFunction(jpqlFunctionGroup);
// count wrapper function
jpqlFunctionGroup = new JpqlFunctionGroup(CountWrapperFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new CountWrapperFunction());
registerFunction(jpqlFunctionGroup);
// query wrapper function
jpqlFunctionGroup = new JpqlFunctionGroup(QueryWrapperFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new QueryWrapperFunction());
registerFunction(jpqlFunctionGroup);
// null subquery function
jpqlFunctionGroup = new JpqlFunctionGroup(NullSubqueryFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new NullSubqueryFunction());
registerFunction(jpqlFunctionGroup);
// greatest
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractGreatestFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new DefaultGreatestFunction());
jpqlFunctionGroup.add("db2", new MaxGreatestFunction());
jpqlFunctionGroup.add("microsoft", new SelectMaxUnionGreatestFunction());
registerFunction(jpqlFunctionGroup);
// least
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractLeastFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new DefaultLeastFunction());
jpqlFunctionGroup.add("db2", new MinLeastFunction());
jpqlFunctionGroup.add("microsoft", new SelectMinUnionLeastFunction());
registerFunction(jpqlFunctionGroup);
// repeat
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractRepeatFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new DefaultRepeatFunction());
jpqlFunctionGroup.add("oracle", new LpadRepeatFunction());
jpqlFunctionGroup.add("microsoft", new ReplicateRepeatFunction());
registerFunction(jpqlFunctionGroup);
// subquery
jpqlFunctionGroup = new JpqlFunctionGroup(SubqueryFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add(null, new SubqueryFunction());
registerFunction(jpqlFunctionGroup);
// every
jpqlFunctionGroup = new JpqlFunctionGroup(EveryFunction.FUNCTION_NAME, true);
jpqlFunctionGroup.add(null, EveryFunction.INSTANCE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), dialectEntry.getValue().supportsBooleanAggregation() ? EveryFunction.INSTANCE : FallbackEveryFunction.INSTANCE);
}
registerFunction(jpqlFunctionGroup);
// andagg
jpqlFunctionGroup = new JpqlFunctionGroup("AND_AGG", true);
jpqlFunctionGroup.add(null, EveryFunction.INSTANCE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), dialectEntry.getValue().supportsBooleanAggregation() ? EveryFunction.INSTANCE : FallbackEveryFunction.INSTANCE);
}
registerFunction(jpqlFunctionGroup);
// oragg
jpqlFunctionGroup = new JpqlFunctionGroup(OrAggFunction.FUNCTION_NAME, true);
jpqlFunctionGroup.add(null, OrAggFunction.INSTANCE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), dialectEntry.getValue().supportsBooleanAggregation() ? OrAggFunction.INSTANCE : FallbackOrAggFunction.INSTANCE);
}
registerFunction(jpqlFunctionGroup);
jpqlFunctionGroup = new JpqlFunctionGroup("OR_AGG", true);
jpqlFunctionGroup.add(null, OrAggFunction.INSTANCE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), dialectEntry.getValue().supportsBooleanAggregation() ? OrAggFunction.INSTANCE : FallbackOrAggFunction.INSTANCE);
}
registerFunction(jpqlFunctionGroup);
// string_json_agg
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractStringJsonAggFunction.FUNCTION_NAME, true);
{
JpqlFunctionGroup chrFunctionGroup = functions.get(ChrFunction.FUNCTION_NAME);
JpqlFunctionGroup replaceFunctionGroup = functions.get(ReplaceFunction.FUNCTION_NAME);
JpqlFunctionGroup concatFunctionGroup = functions.get(ConcatFunction.FUNCTION_NAME);
JpqlFunctionGroup groupConcatFunctionGroup = functions.get(AbstractGroupConcatFunction.FUNCTION_NAME);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
ChrFunction chrFunction = (ChrFunction) chrFunctionGroup.get(dialectEntry.getKey());
if (chrFunction == null) {
chrFunction = (ChrFunction) chrFunctionGroup.get(null);
}
ReplaceFunction replaceFunction = (ReplaceFunction) replaceFunctionGroup.get(dialectEntry.getKey());
if (replaceFunction == null) {
replaceFunction = (ReplaceFunction) replaceFunctionGroup.get(null);
}
ConcatFunction concatFunction = (ConcatFunction) concatFunctionGroup.get(dialectEntry.getKey());
if (concatFunction == null) {
concatFunction = (ConcatFunction) concatFunctionGroup.get(null);
}
jpqlFunctionGroup.add(dialectEntry.getKey(), new GroupConcatBasedStringJsonAggFunction((AbstractGroupConcatFunction) groupConcatFunctionGroup.get(dialectEntry.getKey()), chrFunction, replaceFunction, concatFunction));
}
}
jpqlFunctionGroup.add("postgresql", new PostgreSQLStringJsonAggFunction());
jpqlFunctionGroup.add("oracle", new OracleStringJsonAggFunction((AbstractGroupConcatFunction) findFunction(AbstractGroupConcatFunction.FUNCTION_NAME, "oracle"), (ChrFunction) findFunction(ChrFunction.FUNCTION_NAME, "oracle"), (ReplaceFunction) findFunction(ReplaceFunction.FUNCTION_NAME, "oracle"), (ConcatFunction) findFunction(ConcatFunction.FUNCTION_NAME, "oracle")));
jpqlFunctionGroup.add("mysql", new MySQLStringJsonAggFunction());
jpqlFunctionGroup.add("mysql8", new MySQLStringJsonAggFunction());
registerFunction(jpqlFunctionGroup);
// string_xml_agg
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractStringXmlAggFunction.FUNCTION_NAME, true);
{
JpqlFunctionGroup replaceFunctionGroup = functions.get(ReplaceFunction.FUNCTION_NAME);
JpqlFunctionGroup concatFunctionGroup = functions.get(ConcatFunction.FUNCTION_NAME);
JpqlFunctionGroup groupConcatFunctionGroup = functions.get(AbstractGroupConcatFunction.FUNCTION_NAME);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
ReplaceFunction replaceFunction = (ReplaceFunction) replaceFunctionGroup.get(dialectEntry.getKey());
if (replaceFunction == null) {
replaceFunction = (ReplaceFunction) replaceFunctionGroup.get(null);
}
ConcatFunction concatFunction = (ConcatFunction) concatFunctionGroup.get(dialectEntry.getKey());
if (concatFunction == null) {
concatFunction = (ConcatFunction) concatFunctionGroup.get(null);
}
jpqlFunctionGroup.add(dialectEntry.getKey(), new GroupConcatBasedStringXmlAggFunction((AbstractGroupConcatFunction) groupConcatFunctionGroup.get(dialectEntry.getKey()), replaceFunction, concatFunction));
}
}
jpqlFunctionGroup.add("postgresql", new PostgreSQLStringXmlAggFunction());
jpqlFunctionGroup.add("oracle", new OracleGroupConcatBasedStringXmlAggFunction((AbstractGroupConcatFunction) findFunction(AbstractGroupConcatFunction.FUNCTION_NAME, "oracle"), (ReplaceFunction) findFunction(ReplaceFunction.FUNCTION_NAME, "oracle"), (ConcatFunction) findFunction(ConcatFunction.FUNCTION_NAME, "oracle")));
registerFunction(jpqlFunctionGroup);
// to_string_json
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractToStringJsonFunction.FUNCTION_NAME, false);
{
JpqlFunctionGroup chrFunctionGroup = functions.get(ChrFunction.FUNCTION_NAME);
JpqlFunctionGroup replaceFunctionGroup = functions.get(ReplaceFunction.FUNCTION_NAME);
JpqlFunctionGroup concatFunctionGroup = functions.get(ConcatFunction.FUNCTION_NAME);
JpqlFunctionGroup groupConcatFunctionGroup = functions.get(AbstractGroupConcatFunction.FUNCTION_NAME);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
ChrFunction chrFunction = (ChrFunction) chrFunctionGroup.get(dialectEntry.getKey());
if (chrFunction == null) {
chrFunction = (ChrFunction) chrFunctionGroup.get(null);
}
ReplaceFunction replaceFunction = (ReplaceFunction) replaceFunctionGroup.get(dialectEntry.getKey());
if (replaceFunction == null) {
replaceFunction = (ReplaceFunction) replaceFunctionGroup.get(null);
}
ConcatFunction concatFunction = (ConcatFunction) concatFunctionGroup.get(dialectEntry.getKey());
if (concatFunction == null) {
concatFunction = (ConcatFunction) concatFunctionGroup.get(null);
}
jpqlFunctionGroup.add(dialectEntry.getKey(), new GroupConcatBasedToStringJsonFunction((AbstractGroupConcatFunction) groupConcatFunctionGroup.get(dialectEntry.getKey()), chrFunction, replaceFunction, concatFunction, dialectEntry.getValue().getLateralStyle()));
}
}
jpqlFunctionGroup.add("postgresql", new PostgreSQLToStringJsonFunction());
jpqlFunctionGroup.add("microsoft", new ForJsonPathToStringJsonFunction((CastFunction) findFunction("cast_string", "microsoft")));
jpqlFunctionGroup.add("oracle", new OracleToStringJsonFunction((AbstractGroupConcatFunction) findFunction(AbstractGroupConcatFunction.FUNCTION_NAME, "oracle"), (ChrFunction) findFunction(ChrFunction.FUNCTION_NAME, "oracle"), (ReplaceFunction) findFunction(ReplaceFunction.FUNCTION_NAME, "oracle"), (ConcatFunction) findFunction(ConcatFunction.FUNCTION_NAME, "oracle")));
jpqlFunctionGroup.add("mysql", new MySQLToStringJsonFunction());
jpqlFunctionGroup.add("mysql8", new MySQLToStringJsonFunction());
registerFunction(jpqlFunctionGroup);
// to_string_xml
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractToStringXmlFunction.FUNCTION_NAME, false);
{
JpqlFunctionGroup replaceFunctionGroup = functions.get(ReplaceFunction.FUNCTION_NAME);
JpqlFunctionGroup concatFunctionGroup = functions.get(ConcatFunction.FUNCTION_NAME);
JpqlFunctionGroup groupConcatFunctionGroup = functions.get(AbstractGroupConcatFunction.FUNCTION_NAME);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
ReplaceFunction replaceFunction = (ReplaceFunction) replaceFunctionGroup.get(dialectEntry.getKey());
if (replaceFunction == null) {
replaceFunction = (ReplaceFunction) replaceFunctionGroup.get(null);
}
ConcatFunction concatFunction = (ConcatFunction) concatFunctionGroup.get(dialectEntry.getKey());
if (concatFunction == null) {
concatFunction = (ConcatFunction) concatFunctionGroup.get(null);
}
jpqlFunctionGroup.add(dialectEntry.getKey(), new GroupConcatBasedToStringXmlFunction((AbstractGroupConcatFunction) groupConcatFunctionGroup.get(dialectEntry.getKey()), replaceFunction, concatFunction, dialectEntry.getValue().getLateralStyle()));
}
}
jpqlFunctionGroup.add("postgresql", new PostgreSQLToStringXmlFunction());
jpqlFunctionGroup.add("microsoft", new ForXmlPathToStringXmlFunction((CastFunction) findFunction("cast_string", "microsoft")));
jpqlFunctionGroup.add("oracle", new OracleGroupConcatBasedToStringXmlFunction((AbstractGroupConcatFunction) findFunction(AbstractGroupConcatFunction.FUNCTION_NAME, "oracle"), (ReplaceFunction) findFunction(ReplaceFunction.FUNCTION_NAME, "oracle"), (ConcatFunction) findFunction(ConcatFunction.FUNCTION_NAME, "oracle"), LateralStyle.LATERAL));
registerFunction(jpqlFunctionGroup);
// to_multiset
jpqlFunctionGroup = new JpqlFunctionGroup(ToMultisetFunction.FUNCTION_NAME, false);
{
JpqlFunctionGroup jsonFunctionGroup = functions.get(AbstractToStringJsonFunction.FUNCTION_NAME);
JpqlFunctionGroup xmlFunctionGroup = functions.get(AbstractToStringXmlFunction.FUNCTION_NAME);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
AbstractToStringJsonFunction jsonFunction = (AbstractToStringJsonFunction) jsonFunctionGroup.get(dialectEntry.getKey());
AbstractToStringXmlFunction xmlFunction = (AbstractToStringXmlFunction) xmlFunctionGroup.get(dialectEntry.getKey());
jpqlFunctionGroup.add(dialectEntry.getKey(), new ToMultisetFunction(jsonFunction, xmlFunction));
}
}
registerFunction(jpqlFunctionGroup);
// window every
jpqlFunctionGroup = new JpqlFunctionGroup(WindowEveryFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), dialectEntry.getValue().supportsBooleanAggregation() ? new WindowEveryFunction(dialectEntry.getValue()) : new FallbackWindowEveryFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// window andagg
jpqlFunctionGroup = new JpqlFunctionGroup("AND_AGG", JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), dialectEntry.getValue().supportsBooleanAggregation() ? new WindowEveryFunction(dialectEntry.getValue()) : new FallbackWindowEveryFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// window oragg
jpqlFunctionGroup = new JpqlFunctionGroup(WindowOrAggFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), dialectEntry.getValue().supportsBooleanAggregation() ? new WindowOrAggFunction(dialectEntry.getValue()) : new FallbackWindowOrAggFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// window sum
jpqlFunctionGroup = new JpqlFunctionGroup(SumFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new SumFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// window avg
jpqlFunctionGroup = new JpqlFunctionGroup(AvgFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new AvgFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// window min
jpqlFunctionGroup = new JpqlFunctionGroup(MinFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new MinFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// window max
jpqlFunctionGroup = new JpqlFunctionGroup(MaxFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new MaxFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// window count
jpqlFunctionGroup = new JpqlFunctionGroup(CountFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new CountFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// row number
jpqlFunctionGroup = new JpqlFunctionGroup(RowNumberFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new RowNumberFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// rank
jpqlFunctionGroup = new JpqlFunctionGroup(RankFunction.FUNCTION_NAME, JpqlFunctionKind.ORDERED_SET_AGGREGATE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new RankFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// dense_rank
jpqlFunctionGroup = new JpqlFunctionGroup(DenseRankFunction.FUNCTION_NAME, JpqlFunctionKind.ORDERED_SET_AGGREGATE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new DenseRankFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// PERCENT_RANK
jpqlFunctionGroup = new JpqlFunctionGroup(PercentRankFunction.FUNCTION_NAME, JpqlFunctionKind.ORDERED_SET_AGGREGATE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new PercentRankFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// CUME_DIST
jpqlFunctionGroup = new JpqlFunctionGroup(CumeDistFunction.FUNCTION_NAME, JpqlFunctionKind.ORDERED_SET_AGGREGATE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new CumeDistFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// NTILE
jpqlFunctionGroup = new JpqlFunctionGroup(NtileFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new NtileFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// LAG
jpqlFunctionGroup = new JpqlFunctionGroup(LagFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new LagFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// LEAD
jpqlFunctionGroup = new JpqlFunctionGroup(LeadFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new LeadFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// FIRST_VALUE
jpqlFunctionGroup = new JpqlFunctionGroup(FirstValueFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new FirstValueFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// LAST_VALUE
jpqlFunctionGroup = new JpqlFunctionGroup(LastValueFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new LastValueFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// NTH_VALUE
jpqlFunctionGroup = new JpqlFunctionGroup(NthValueFunction.FUNCTION_NAME, JpqlFunctionKind.WINDOW);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new NthValueFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// JSON_GET
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractJsonGetFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add("postgresql", new PostgreSQLJsonGetFunction());
jpqlFunctionGroup.add("mysql8", new MySQL8JsonGetFunction());
jpqlFunctionGroup.add("oracle", new OracleJsonGetFunction());
jpqlFunctionGroup.add("db2", new DB2JsonGetFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLJsonGetFunction());
registerFunction(jpqlFunctionGroup);
// JSON_SET
jpqlFunctionGroup = new JpqlFunctionGroup(AbstractJsonSetFunction.FUNCTION_NAME, false);
jpqlFunctionGroup.add("postgresql", new PostgreSQLJsonSetFunction());
jpqlFunctionGroup.add("mysql8", new MySQL8JsonSetFunction());
jpqlFunctionGroup.add("oracle", new OracleJsonSetFunction());
jpqlFunctionGroup.add("db2", new DB2JsonSetFunction());
jpqlFunctionGroup.add("microsoft", new MSSQLJsonSetFunction());
registerFunction(jpqlFunctionGroup);
// grouping
registerFunction(GroupingFunction.FUNCTION_NAME, new GroupingFunction());
registerFunction(GroupingSetFunction.FUNCTION_NAME, new GroupingSetFunction());
registerFunction(GroupingSetsFunction.FUNCTION_NAME, new GroupingSetsFunction());
registerFunction(CubeFunction.FUNCTION_NAME, new CubeFunction());
registerFunction(RollupFunction.FUNCTION_NAME, new RollupFunction());
// MODE
jpqlFunctionGroup = new JpqlFunctionGroup(ModeFunction.FUNCTION_NAME, JpqlFunctionKind.ORDERED_SET_AGGREGATE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new ModeFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// PERCENTILE_CONT
jpqlFunctionGroup = new JpqlFunctionGroup(PercentileContFunction.FUNCTION_NAME, JpqlFunctionKind.ORDERED_SET_AGGREGATE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new PercentileContFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
// PERCENTILE_DISC
jpqlFunctionGroup = new JpqlFunctionGroup(PercentileDiscFunction.FUNCTION_NAME, JpqlFunctionKind.ORDERED_SET_AGGREGATE);
for (Map.Entry<String, DbmsDialect> dialectEntry : this.dbmsDialects.entrySet()) {
jpqlFunctionGroup.add(dialectEntry.getKey(), new PercentileDiscFunction(dialectEntry.getValue()));
}
registerFunction(jpqlFunctionGroup);
}
Aggregations