Search in sources :

Example 1 with IntegralTimestampaddFunction

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

the class AbstractHANADialect method initializeFunctionRegistry.

@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
    super.initializeFunctionRegistry(queryEngine);
    final TypeConfiguration typeConfiguration = queryEngine.getTypeConfiguration();
    queryEngine.getSqmFunctionRegistry().registerBinaryTernaryPattern("locate", typeConfiguration.getBasicTypeRegistry().resolve(StandardBasicTypes.INTEGER), "locate(?2,?1)", "locate(?2,?1,?3)", FunctionParameterType.STRING, FunctionParameterType.STRING, FunctionParameterType.INTEGER, typeConfiguration).setArgumentListSignature("(pattern, string[, start])");
    CommonFunctionFactory functionFactory = new CommonFunctionFactory(queryEngine);
    functionFactory.ceiling_ceil();
    functionFactory.concat_pipeOperator();
    functionFactory.trim2();
    functionFactory.cot();
    functionFactory.cosh();
    functionFactory.sinh();
    functionFactory.tanh();
    functionFactory.log10_log();
    functionFactory.bitand();
    functionFactory.hourMinuteSecond();
    functionFactory.yearMonthDay();
    functionFactory.dayofweekmonthyear();
    functionFactory.weekQuarter();
    functionFactory.daynameMonthname();
    functionFactory.lastDay();
    functionFactory.characterLength_length(SqlAstNodeRenderingMode.DEFAULT);
    functionFactory.ascii();
    functionFactory.chr_char();
    functionFactory.addYearsMonthsDaysHoursMinutesSeconds();
    functionFactory.daysBetween();
    functionFactory.secondsBetween();
    functionFactory.format_toVarchar();
    functionFactory.currentUtcdatetimetimestamp();
    functionFactory.everyAny_minMaxCase();
    functionFactory.bitLength_pattern("length(to_binary(?1))*8");
    functionFactory.windowFunctions();
    functionFactory.listagg_stringAgg("varchar");
    functionFactory.inverseDistributionOrderedSetAggregates();
    functionFactory.hypotheticalOrderedSetAggregates_windowEmulation();
    queryEngine.getSqmFunctionRegistry().register("timestampadd", new IntegralTimestampaddFunction(this, typeConfiguration));
}
Also used : IntegralTimestampaddFunction(org.hibernate.dialect.function.IntegralTimestampaddFunction) CommonFunctionFactory(org.hibernate.dialect.function.CommonFunctionFactory) TypeConfiguration(org.hibernate.type.spi.TypeConfiguration)

Example 2 with IntegralTimestampaddFunction

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

the class SybaseDialect method initializeFunctionRegistry.

@Override
public void initializeFunctionRegistry(QueryEngine queryEngine) {
    super.initializeFunctionRegistry(queryEngine);
    CommonFunctionFactory functionFactory = new CommonFunctionFactory(queryEngine);
    // For SQL-Server we need to cast certain arguments to varchar(16384) to be able to concat them
    queryEngine.getSqmFunctionRegistry().register("count", new CountFunction(this, queryEngine.getTypeConfiguration(), SqlAstNodeRenderingMode.DEFAULT, "+", "varchar(16384)", false));
    // 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);
    // this doesn't work 100% on earlier versions of Sybase
    // which were missing the third parameter in charindex()
    // TODO: we could emulate it with substring() like in Postgres
    functionFactory.locate_charindex();
    functionFactory.replace_strReplace();
    functionFactory.everyAny_minMaxCase();
    functionFactory.bitLength_pattern("datalength(?1) * 8");
    queryEngine.getSqmFunctionRegistry().register("timestampadd", new IntegralTimestampaddFunction(this, queryEngine.getTypeConfiguration()));
}
Also used : IntegralTimestampaddFunction(org.hibernate.dialect.function.IntegralTimestampaddFunction) CountFunction(org.hibernate.dialect.function.CountFunction) CommonFunctionFactory(org.hibernate.dialect.function.CommonFunctionFactory)

Aggregations

CommonFunctionFactory (org.hibernate.dialect.function.CommonFunctionFactory)2 IntegralTimestampaddFunction (org.hibernate.dialect.function.IntegralTimestampaddFunction)2 CountFunction (org.hibernate.dialect.function.CountFunction)1 TypeConfiguration (org.hibernate.type.spi.TypeConfiguration)1