Search in sources :

Example 1 with CaseLeastGreatestEmulation

use of org.hibernate.dialect.function.CaseLeastGreatestEmulation in project hibernate-orm by hibernate.

the class InformixDialect method initializeFunctionRegistry.

@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
    super.initializeFunctionRegistry(queryEngine);
    CommonFunctionFactory functionFactory = new CommonFunctionFactory(queryEngine);
    functionFactory.instr();
    functionFactory.substr();
    functionFactory.substring_substr();
    // also natively supports ANSI-style substring()
    functionFactory.trunc();
    functionFactory.trim2();
    functionFactory.space();
    functionFactory.reverse();
    functionFactory.octetLength();
    functionFactory.degrees();
    functionFactory.radians();
    functionFactory.sinh();
    functionFactory.tanh();
    functionFactory.cosh();
    functionFactory.moreHyperbolic();
    functionFactory.log10();
    functionFactory.initcap();
    functionFactory.yearMonthDay();
    functionFactory.ceiling_ceil();
    functionFactory.concat_pipeOperator();
    functionFactory.ascii();
    functionFactory.char_chr();
    functionFactory.addMonths();
    functionFactory.monthsBetween();
    functionFactory.stddev();
    functionFactory.variance();
    functionFactory.locate_positionSubstring();
    // coalesce() and nullif() both supported since Informix 12
    queryEngine.getSqmFunctionRegistry().register("least", new CaseLeastGreatestEmulation(true));
    queryEngine.getSqmFunctionRegistry().register("greatest", new CaseLeastGreatestEmulation(false));
    if (supportsWindowFunctions()) {
        functionFactory.windowFunctions();
    }
}
Also used : CommonFunctionFactory(org.hibernate.dialect.function.CommonFunctionFactory) CaseLeastGreatestEmulation(org.hibernate.dialect.function.CaseLeastGreatestEmulation)

Example 2 with CaseLeastGreatestEmulation

use of org.hibernate.dialect.function.CaseLeastGreatestEmulation 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));
}
Also used : InsertSubstringOverlayEmulation(org.hibernate.dialect.function.InsertSubstringOverlayEmulation) DerbyLpadEmulation(org.hibernate.dialect.function.DerbyLpadEmulation) DerbyRpadEmulation(org.hibernate.dialect.function.DerbyRpadEmulation) CountFunction(org.hibernate.dialect.function.CountFunction) CommonFunctionFactory(org.hibernate.dialect.function.CommonFunctionFactory) CaseLeastGreatestEmulation(org.hibernate.dialect.function.CaseLeastGreatestEmulation) BasicTypeRegistry(org.hibernate.type.BasicTypeRegistry) CastingConcatFunction(org.hibernate.dialect.function.CastingConcatFunction)

Example 3 with CaseLeastGreatestEmulation

use of org.hibernate.dialect.function.CaseLeastGreatestEmulation in project hibernate-orm by hibernate.

the class AbstractTransactSQLDialect method initializeFunctionRegistry.

@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
    super.initializeFunctionRegistry(queryEngine);
    CommonFunctionFactory functionFactory = new CommonFunctionFactory(queryEngine);
    functionFactory.cot();
    functionFactory.log();
    functionFactory.ln_log();
    functionFactory.log10();
    functionFactory.atan2_atn2();
    functionFactory.mod_operator();
    functionFactory.square();
    functionFactory.rand();
    functionFactory.radians();
    functionFactory.degrees();
    functionFactory.pi();
    functionFactory.reverse();
    functionFactory.space();
    functionFactory.pad_replicate();
    functionFactory.yearMonthDay();
    functionFactory.ascii();
    functionFactory.chr_char();
    functionFactory.trim1();
    functionFactory.repeat_replicate();
    functionFactory.characterLength_len();
    functionFactory.substring_substringLen();
    functionFactory.datepartDatename();
    functionFactory.lastDay_eomonth();
    queryEngine.getSqmFunctionRegistry().register("least", new CaseLeastGreatestEmulation(true));
    queryEngine.getSqmFunctionRegistry().register("greatest", new CaseLeastGreatestEmulation(false));
    queryEngine.getSqmFunctionRegistry().register("str", new TransactSQLStrFunction(queryEngine.getTypeConfiguration()));
    queryEngine.getSqmFunctionRegistry().register("concat", new CastingConcatFunction(this, "+", false, SqlAstNodeRenderingMode.DEFAULT, queryEngine.getTypeConfiguration()));
}
Also used : CommonFunctionFactory(org.hibernate.dialect.function.CommonFunctionFactory) CaseLeastGreatestEmulation(org.hibernate.dialect.function.CaseLeastGreatestEmulation) TransactSQLStrFunction(org.hibernate.dialect.function.TransactSQLStrFunction) CastingConcatFunction(org.hibernate.dialect.function.CastingConcatFunction)

Aggregations

CaseLeastGreatestEmulation (org.hibernate.dialect.function.CaseLeastGreatestEmulation)3 CommonFunctionFactory (org.hibernate.dialect.function.CommonFunctionFactory)3 CastingConcatFunction (org.hibernate.dialect.function.CastingConcatFunction)2 CountFunction (org.hibernate.dialect.function.CountFunction)1 DerbyLpadEmulation (org.hibernate.dialect.function.DerbyLpadEmulation)1 DerbyRpadEmulation (org.hibernate.dialect.function.DerbyRpadEmulation)1 InsertSubstringOverlayEmulation (org.hibernate.dialect.function.InsertSubstringOverlayEmulation)1 TransactSQLStrFunction (org.hibernate.dialect.function.TransactSQLStrFunction)1 BasicTypeRegistry (org.hibernate.type.BasicTypeRegistry)1