use of org.hibernate.dialect.function.CommonFunctionFactory in project hibernate-orm by hibernate.
the class MariaDBDialect method initializeFunctionRegistry.
@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
super.initializeFunctionRegistry(queryEngine);
if (getVersion().isSameOrAfter(10, 2)) {
CommonFunctionFactory commonFunctionFactory = new CommonFunctionFactory(queryEngine);
commonFunctionFactory.windowFunctions();
commonFunctionFactory.hypotheticalOrderedSetAggregates_windowEmulation();
queryEngine.getSqmFunctionRegistry().registerNamed("json_valid", queryEngine.getTypeConfiguration().getBasicTypeRegistry().resolve(StandardBasicTypes.BOOLEAN));
if (getVersion().isSameOrAfter(10, 3, 3)) {
commonFunctionFactory.inverseDistributionOrderedSetAggregates_windowEmulation();
}
}
}
use of org.hibernate.dialect.function.CommonFunctionFactory in project hibernate-orm by hibernate.
the class DB2zDialect method initializeFunctionRegistry.
@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
super.initializeFunctionRegistry(queryEngine);
if (getVersion().isSameOrAfter(12)) {
CommonFunctionFactory functionFactory = new CommonFunctionFactory(queryEngine);
functionFactory.listagg(null);
functionFactory.inverseDistributionOrderedSetAggregates();
functionFactory.hypotheticalOrderedSetAggregates_windowEmulation();
}
}
use of org.hibernate.dialect.function.CommonFunctionFactory in project hibernate-orm by hibernate.
the class DerbyDialect method initializeFunctionRegistry.
@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
super.initializeFunctionRegistry(queryEngine);
final BasicTypeRegistry basicTypeRegistry = queryEngine.getTypeConfiguration().getBasicTypeRegistry();
final BasicType<String> stringType = basicTypeRegistry.resolve(StandardBasicTypes.STRING);
CommonFunctionFactory functionFactory = new CommonFunctionFactory(queryEngine);
// Derby needs an actual argument type for aggregates like SUM, AVG, MIN, MAX to determine the result type
functionFactory.aggregates(this, SqlAstNodeRenderingMode.NO_PLAIN_PARAMETER);
queryEngine.getSqmFunctionRegistry().register("count", new CountFunction(this, queryEngine.getTypeConfiguration(), SqlAstNodeRenderingMode.NO_PLAIN_PARAMETER, "||", getCastTypeName(stringType, null, null, null), true));
// AVG by default uses the input type, so we possibly need to cast the argument type, hence a special function
functionFactory.avg_castingNonDoubleArguments(this, SqlAstNodeRenderingMode.DEFAULT);
functionFactory.concat_pipeOperator();
functionFactory.cot();
functionFactory.chr_char();
functionFactory.degrees();
functionFactory.radians();
functionFactory.log10();
functionFactory.sinh();
functionFactory.cosh();
functionFactory.tanh();
functionFactory.pi();
functionFactory.rand();
functionFactory.trim1();
functionFactory.hourMinuteSecond();
functionFactory.yearMonthDay();
functionFactory.varPopSamp();
functionFactory.stddevPopSamp();
functionFactory.substring_substr();
functionFactory.leftRight_substrLength();
functionFactory.characterLength_length(SqlAstNodeRenderingMode.NO_PLAIN_PARAMETER);
functionFactory.power_expLn();
functionFactory.round_floor();
functionFactory.bitLength_pattern("length(?1)*8");
queryEngine.getSqmFunctionRegistry().register("concat", new CastingConcatFunction(this, "||", true, SqlAstNodeRenderingMode.NO_PLAIN_PARAMETER, queryEngine.getTypeConfiguration()));
// no way I can see to pad with anything other than spaces
queryEngine.getSqmFunctionRegistry().register("lpad", new DerbyLpadEmulation(queryEngine.getTypeConfiguration()));
queryEngine.getSqmFunctionRegistry().register("rpad", new DerbyRpadEmulation(queryEngine.getTypeConfiguration()));
queryEngine.getSqmFunctionRegistry().register("least", new CaseLeastGreatestEmulation(true));
queryEngine.getSqmFunctionRegistry().register("greatest", new CaseLeastGreatestEmulation(false));
queryEngine.getSqmFunctionRegistry().register("overlay", new InsertSubstringOverlayEmulation(queryEngine.getTypeConfiguration(), true));
}
use of org.hibernate.dialect.function.CommonFunctionFactory in project hibernate-orm by hibernate.
the class HSQLDialect method initializeFunctionRegistry.
@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
super.initializeFunctionRegistry(queryEngine);
CommonFunctionFactory functionFactory = new CommonFunctionFactory(queryEngine);
// AVG by default uses the input type, so we possibly need to cast the argument type, hence a special function
functionFactory.avg_castingNonDoubleArguments(this, SqlAstNodeRenderingMode.DEFAULT);
functionFactory.cot();
functionFactory.radians();
functionFactory.degrees();
functionFactory.log10();
functionFactory.rand();
functionFactory.trunc();
functionFactory.truncate();
functionFactory.pi();
functionFactory.soundex();
functionFactory.reverse();
functionFactory.space();
functionFactory.repeat();
functionFactory.translate();
functionFactory.bitand();
functionFactory.bitor();
functionFactory.bitxor();
functionFactory.bitnot();
functionFactory.yearMonthDay();
functionFactory.hourMinuteSecond();
functionFactory.dayofweekmonthyear();
functionFactory.weekQuarter();
functionFactory.daynameMonthname();
functionFactory.lastDay();
functionFactory.trim1();
functionFactory.toCharNumberDateTimestamp();
functionFactory.concat_pipeOperator();
functionFactory.localtimeLocaltimestamp();
functionFactory.bitLength();
functionFactory.octetLength();
functionFactory.ascii();
functionFactory.chr_char();
functionFactory.instr();
functionFactory.substr();
// also natively supports ANSI-style substring()
functionFactory.position();
functionFactory.nowCurdateCurtime();
functionFactory.insert();
functionFactory.overlay();
functionFactory.median();
functionFactory.stddevPopSamp();
functionFactory.varPopSamp();
functionFactory.addMonths();
functionFactory.monthsBetween();
functionFactory.collate_quoted();
if (getVersion().isSameOrAfter(2)) {
// SYSDATE is similar to LOCALTIMESTAMP but it returns the timestamp when it is called
functionFactory.sysdate();
}
// from v. 2.2.0 ROWNUM() is supported in all modes as the equivalent of Oracle ROWNUM
if (getVersion().isSameOrAfter(2, 2)) {
functionFactory.rownum();
}
functionFactory.listagg_groupConcat();
}
use of org.hibernate.dialect.function.CommonFunctionFactory in project hibernate-orm by hibernate.
the class CacheDialect method initializeFunctionRegistry.
@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
super.initializeFunctionRegistry(queryEngine);
CommonFunctionFactory functionFactory = new CommonFunctionFactory(queryEngine);
functionFactory.repeat();
functionFactory.trim2();
functionFactory.substr();
// also natively supports ANSI-style substring()
functionFactory.concat_pipeOperator();
functionFactory.cot();
functionFactory.log10();
functionFactory.log();
functionFactory.pi();
functionFactory.space();
functionFactory.hourMinuteSecond();
functionFactory.yearMonthDay();
functionFactory.weekQuarter();
functionFactory.daynameMonthname();
functionFactory.toCharNumberDateTimestamp();
functionFactory.truncate();
functionFactory.dayofweekmonthyear();
functionFactory.repeat_replicate();
functionFactory.datepartDatename();
functionFactory.ascii();
functionFactory.chr_char();
functionFactory.nowCurdateCurtime();
functionFactory.sysdate();
functionFactory.stddev();
functionFactory.stddevPopSamp();
functionFactory.variance();
functionFactory.varPopSamp();
functionFactory.lastDay();
queryEngine.getSqmFunctionRegistry().registerBinaryTernaryPattern("locate", queryEngine.getTypeConfiguration().getBasicTypeRegistry().resolve(StandardBasicTypes.INTEGER), "$find(?2,?1)", "$find(?2,?1,?3)", STRING, STRING, INTEGER, queryEngine.getTypeConfiguration()).setArgumentListSignature("(pattern, string[, start])");
functionFactory.bitLength_pattern("($length(?1)*8)");
useJdbcEscape(queryEngine, "sin");
useJdbcEscape(queryEngine, "cos");
useJdbcEscape(queryEngine, "tan");
useJdbcEscape(queryEngine, "asin");
useJdbcEscape(queryEngine, "acos");
useJdbcEscape(queryEngine, "atan");
useJdbcEscape(queryEngine, "atan2");
useJdbcEscape(queryEngine, "exp");
useJdbcEscape(queryEngine, "log");
useJdbcEscape(queryEngine, "log10");
useJdbcEscape(queryEngine, "pi");
useJdbcEscape(queryEngine, "truncate");
useJdbcEscape(queryEngine, "left");
useJdbcEscape(queryEngine, "right");
useJdbcEscape(queryEngine, "hour");
useJdbcEscape(queryEngine, "minute");
useJdbcEscape(queryEngine, "second");
useJdbcEscape(queryEngine, "week");
useJdbcEscape(queryEngine, "quarter");
useJdbcEscape(queryEngine, "dayname");
useJdbcEscape(queryEngine, "monthname");
useJdbcEscape(queryEngine, "dayofweek");
useJdbcEscape(queryEngine, "dayofmonth");
useJdbcEscape(queryEngine, "dayofyear");
}
Aggregations