Package org.hibernate.dialect.function

Examples of org.hibernate.dialect.function.SQLFunctionTemplate


    super();

    registerColumnType( Types.LONGVARBINARY, "image" );
    registerColumnType( Types.LONGVARCHAR, "text" );

    registerFunction( "second", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(second, ?1)") );
    registerFunction( "minute", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "datepart(minute, ?1)") );
    registerFunction( "hour", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "datepart(hour, ?1)") );
    registerFunction( "extract", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(?1, ?3)" ) );
    registerFunction( "mod", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "?1 % ?2" ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datalength(?1) * 8" ) );
    registerFunction( "trim", new AnsiTrimEmulationFunction( AnsiTrimEmulationFunction.LTRIM, AnsiTrimEmulationFunction.RTRIM, "str_replace" ) );
  }
View Full Code Here


    registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
    registerFunction( "reverse", new StandardSQLFunction( "reverse" ) );
    registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
    registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex" ) );
    registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw" ) );
    registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as varchar(24))" ) );
    registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
    registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );

    registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.DATE, false ) );
    registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
View Full Code Here

    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
    registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
    registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "octet_length(hex(?1))*4" ) );
    registerFunction( "bit_not", new StandardSQLFunction( "bit_not" ) );
    registerFunction( "bit_or", new StandardSQLFunction( "bit_or" ) );
    registerFunction( "bit_xor", new StandardSQLFunction( "bit_xor" ) );
    registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.LONG ) );
    registerFunction( "charextract", new StandardSQLFunction( "charextract", Hibernate.STRING ) );
    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "+", ")" ) );
    registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
    registerFunction( "current_user", new NoArgSQLFunction( "current_user", Hibernate.STRING, false ) );
    registerFunction( "current_time", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "current_date", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
    registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
    registerFunction( "dba", new NoArgSQLFunction( "dba", Hibernate.STRING, true ) );
    registerFunction( "dow", new StandardSQLFunction( "dow", Hibernate.STRING ) );
    registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "date_part('?1', ?3)" ) );
    registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
    registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
    registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
    registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
    registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
    registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", Hibernate.STRING, false ) );
    registerFunction( "intextract", new StandardSQLFunction( "intextract", Hibernate.INTEGER ) );
    registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
    registerFunction( "locate", new SQLFunctionTemplate( Hibernate.LONG, "locate(?1, ?2)" ) );
    registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
    registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
    registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "lower", new StandardSQLFunction( "lower" ) );
    registerFunction( "lowercase", new StandardSQLFunction( "lowercase" ) );
    registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
    registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
    registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
    registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
    registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
    registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
    registerFunction( "random", new NoArgSQLFunction( "random", Hibernate.LONG, true ) );
    registerFunction( "randomf", new NoArgSQLFunction( "randomf", Hibernate.DOUBLE, true ) );
    registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
    registerFunction( "session_user", new NoArgSQLFunction( "session_user", Hibernate.STRING, false ) );
    registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
    registerFunction( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
    registerFunction( "squeeze", new StandardSQLFunction( "squeeze" ) );
    registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
    registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
    registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
    registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
    registerFunction( "system_user", new NoArgSQLFunction( "system_user", Hibernate.STRING, false ) );
    //registerFunction( "trim", new StandardSQLFunction( "trim", Hibernate.STRING ) );
    registerFunction( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
    registerFunction( "upper", new StandardSQLFunction( "upper" ) );
    registerFunction( "uppercase", new StandardSQLFunction( "uppercase" ) );
    registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING, false ) );
    registerFunction( "usercode", new NoArgSQLFunction( "usercode", Hibernate.STRING, true ) );
    registerFunction( "username", new NoArgSQLFunction( "username", Hibernate.STRING, true ) );
    registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", Hibernate.BYTE ) );
    registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", Hibernate.INTEGER ) );
    registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", Hibernate.BYTE ) );
    registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", Hibernate.STRING ) );
    registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
    // Casting to char of numeric values introduces space padding up to the
    // maximum width of a value for that return type.  Casting to varchar
    // does not introduce space padding.
    registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as varchar)") );
        // Ingres driver supports getGeneratedKeys but only in the following
        // form:
        // The Ingres DBMS returns only a single table key or a single object
        // key per insert statement. Ingres does not return table and object
        // keys for INSERT AS SELECT statements. Depending on the keys that are
View Full Code Here

  protected Dialect() {
    log.info( "Using dialect: " + this );
    StandardAnsiSqlAggregationFunctions.primeFunctionMap( sqlFunctions );

    // standard sql92 functions (can be overridden by subclasses)
    registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1, ?2, ?3)" ) );
    registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "locate(?1, ?2, ?3)" ) );
    registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "trim(?1 ?2 ?3 ?4)" ) );
    registerFunction( "length", new StandardSQLFunction( "length", Hibernate.INTEGER ) );
    registerFunction( "bit_length", new StandardSQLFunction( "bit_length", Hibernate.INTEGER ) );
    registerFunction( "coalesce", new StandardSQLFunction( "coalesce" ) );
    registerFunction( "nullif", new StandardSQLFunction( "nullif" ) );
    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER) );
    registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE) );
    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "cast", new CastFunction() );
    registerFunction( "extract", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(?1 ?2 ?3)") );

    //map second/minute/hour/day/month/year to ANSI extract(), override on subclasses
    registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(second from ?1)") );
    registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(minute from ?1)") );
    registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(hour from ?1)") );
    registerFunction( "day", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(day from ?1)") );
    registerFunction( "month", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(month from ?1)") );
    registerFunction( "year", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(year from ?1)") );

    registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as char)") );

        // register hibernate types for default use in scalar sqlquery type auto detection
    registerHibernateType( Types.BIGINT, Hibernate.BIG_INTEGER.getName() );
    registerHibernateType( Types.BINARY, Hibernate.BINARY.getName() );
    registerHibernateType( Types.BIT, Hibernate.BOOLEAN.getName() );
View Full Code Here

    registerFunction("rtrim", new StandardSQLFunction("rtrim") );
    registerFunction( "substr", new StandardSQLFunction( "substr", Hibernate.STRING ) );
    registerFunction( "posstr", new StandardSQLFunction( "posstr", Hibernate.INTEGER ) );

    registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "length(?1)*8" ) );
    registerFunction( "trim", new AnsiTrimEmulationFunction() );

    registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );

    registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "rtrim(char(?1))" ) );

    registerKeyword("current");
    registerKeyword("date");
    registerKeyword("time");
    registerKeyword("timestamp");
View Full Code Here

    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","||",")" ) );

    registerFunction( "locate", new PositionSubstringFunction() );

    registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as varchar)") );

    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
  }
View Full Code Here

    registerColumnType( Types.VARBINARY, "image" );
    registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
    registerColumnType( Types.LONGVARBINARY, "image" );
    registerColumnType( Types.LONGVARCHAR, "text" );

    registerFunction( "second", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(second, ?1)" ) );
    registerFunction( "minute", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(minute, ?1)" ) );
    registerFunction( "hour", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(hour, ?1)" ) );
    registerFunction( "locate", new StandardSQLFunction( "charindex", Hibernate.INTEGER ) );

    registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
    registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "datalength(?1) * 8" ) );

    registerFunction( "trim", new AnsiTrimEmulationFunction() );

    registerKeyword( "top" );
  }
View Full Code Here

    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","||",")" ) );

    registerFunction( "locate", new PositionSubstringFunction() );

    registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as varchar)") );

    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
  }
View Full Code Here

    registerFunction( "acos", new StandardJDBCEscapeFunction( "acos", Hibernate.DOUBLE ) );
    registerFunction( "%alphaup", new StandardSQLFunction( "%alphaup", Hibernate.STRING ) );
    registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.STRING ) );
    registerFunction( "asin", new StandardJDBCEscapeFunction( "asin", Hibernate.DOUBLE ) );
    registerFunction( "atan", new StandardJDBCEscapeFunction( "atan", Hibernate.DOUBLE ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "($length(?1)*8)" ) );
    // hibernate impelemnts cast in Dialect.java
    registerFunction( "ceiling", new StandardSQLFunction( "ceiling", Hibernate.INTEGER ) );
    registerFunction( "char", new StandardJDBCEscapeFunction( "char", Hibernate.CHARACTER ) );
    registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.INTEGER ) );
    registerFunction( "char_length", new StandardSQLFunction( "char_length", Hibernate.INTEGER ) );
    registerFunction( "cos", new StandardJDBCEscapeFunction( "cos", Hibernate.DOUBLE ) );
    registerFunction( "cot", new StandardJDBCEscapeFunction( "cot", Hibernate.DOUBLE ) );
    registerFunction( "coalesce", new VarArgsSQLFunction( "coalesce(", ",", ")" ) );
    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "", "||", "" ) );
    registerFunction( "convert", new ConvertFunction() );
    registerFunction( "curdate", new StandardJDBCEscapeFunction( "curdate", Hibernate.DATE ) );
    registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
    registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
    registerFunction(
        "current_timestamp", new ConditionalParenthesisFunction( "current_timestamp", Hibernate.TIMESTAMP )
    );
    registerFunction( "curtime", new StandardJDBCEscapeFunction( "curtime", Hibernate.TIME ) );
    registerFunction( "database", new StandardJDBCEscapeFunction( "database", Hibernate.STRING ) );
    registerFunction( "dateadd", new VarArgsSQLFunction( Hibernate.TIMESTAMP, "dateadd(", ",", ")" ) );
    registerFunction( "datediff", new VarArgsSQLFunction( Hibernate.INTEGER, "datediff(", ",", ")" ) );
    registerFunction( "datename", new VarArgsSQLFunction( Hibernate.STRING, "datename(", ",", ")" ) );
    registerFunction( "datepart", new VarArgsSQLFunction( Hibernate.INTEGER, "datepart(", ",", ")" ) );
    registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
    registerFunction( "dayname", new StandardJDBCEscapeFunction( "dayname", Hibernate.STRING ) );
    registerFunction( "dayofmonth", new StandardJDBCEscapeFunction( "dayofmonth", Hibernate.INTEGER ) );
    registerFunction( "dayofweek", new StandardJDBCEscapeFunction( "dayofweek", Hibernate.INTEGER ) );
    registerFunction( "dayofyear", new StandardJDBCEscapeFunction( "dayofyear", Hibernate.INTEGER ) );
    // is it necessary to register %exact since it can only appear in a where clause?
    registerFunction( "%exact", new StandardSQLFunction( "%exact", Hibernate.STRING ) );
    registerFunction( "exp", new StandardJDBCEscapeFunction( "exp", Hibernate.DOUBLE ) );
    registerFunction( "%external", new StandardSQLFunction( "%external", Hibernate.STRING ) );
    registerFunction( "$extract", new VarArgsSQLFunction( Hibernate.INTEGER, "$extract(", ",", ")" ) );
    registerFunction( "$find", new VarArgsSQLFunction( Hibernate.INTEGER, "$find(", ",", ")" ) );
    registerFunction( "floor", new StandardSQLFunction( "floor", Hibernate.INTEGER ) );
    registerFunction( "getdate", new StandardSQLFunction( "getdate", Hibernate.TIMESTAMP ) );
    registerFunction( "hour", new StandardJDBCEscapeFunction( "hour", Hibernate.INTEGER ) );
    registerFunction( "ifnull", new VarArgsSQLFunction( "ifnull(", ",", ")" ) );
    registerFunction( "%internal", new StandardSQLFunction( "%internal" ) );
    registerFunction( "isnull", new VarArgsSQLFunction( "isnull(", ",", ")" ) );
    registerFunction( "isnumeric", new StandardSQLFunction( "isnumeric", Hibernate.INTEGER ) );
    registerFunction( "lcase", new StandardJDBCEscapeFunction( "lcase", Hibernate.STRING ) );
    registerFunction( "left", new StandardJDBCEscapeFunction( "left", Hibernate.STRING ) );
    registerFunction( "len", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
    registerFunction( "$length", new VarArgsSQLFunction( "$length(", ",", ")" ) );
    // aggregate functions shouldn't be registered, right?
    //registerFunction( "list", new StandardSQLFunction("list",Hibernate.STRING) );
    // stopped on $list
    registerFunction( "$list", new VarArgsSQLFunction( "$list(", ",", ")" ) );
    registerFunction( "$listdata", new VarArgsSQLFunction( "$listdata(", ",", ")" ) );
    registerFunction( "$listfind", new VarArgsSQLFunction( "$listfind(", ",", ")" ) );
    registerFunction( "$listget", new VarArgsSQLFunction( "$listget(", ",", ")" ) );
    registerFunction( "$listlength", new StandardSQLFunction( "$listlength", Hibernate.INTEGER ) );
    registerFunction( "locate", new StandardSQLFunction( "$FIND", Hibernate.INTEGER ) );
    registerFunction( "log", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "log10", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "lower", new StandardSQLFunction( "lower" ) );
    registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
    registerFunction( "minute", new StandardJDBCEscapeFunction( "minute", Hibernate.INTEGER ) );
    registerFunction( "mod", new StandardJDBCEscapeFunction( "mod", Hibernate.DOUBLE ) );
    registerFunction( "month", new StandardJDBCEscapeFunction( "month", Hibernate.INTEGER ) );
    registerFunction( "monthname", new StandardJDBCEscapeFunction( "monthname", Hibernate.STRING ) );
    registerFunction( "now", new StandardJDBCEscapeFunction( "monthname", Hibernate.TIMESTAMP ) );
    registerFunction( "nullif", new VarArgsSQLFunction( "nullif(", ",", ")" ) );
    registerFunction( "nvl", new NvlFunction() );
    registerFunction( "%odbcin", new StandardSQLFunction( "%odbcin" ) );
    registerFunction( "%odbcout", new StandardSQLFunction( "%odbcin" ) );
    registerFunction( "%pattern", new VarArgsSQLFunction( Hibernate.STRING, "", "%pattern", "" ) );
    registerFunction( "pi", new StandardJDBCEscapeFunction( "pi", Hibernate.DOUBLE ) );
    registerFunction( "$piece", new VarArgsSQLFunction( Hibernate.STRING, "$piece(", ",", ")" ) );
    registerFunction( "position", new VarArgsSQLFunction( Hibernate.INTEGER, "position(", " in ", ")" ) );
    registerFunction( "power", new VarArgsSQLFunction( Hibernate.STRING, "power(", ",", ")" ) );
    registerFunction( "quarter", new StandardJDBCEscapeFunction( "quarter", Hibernate.INTEGER ) );
    registerFunction( "repeat", new VarArgsSQLFunction( Hibernate.STRING, "repeat(", ",", ")" ) );
    registerFunction( "replicate", new VarArgsSQLFunction( Hibernate.STRING, "replicate(", ",", ")" ) );
    registerFunction( "right", new StandardJDBCEscapeFunction( "right", Hibernate.STRING ) );
    registerFunction( "round", new VarArgsSQLFunction( Hibernate.FLOAT, "round(", ",", ")" ) );
    registerFunction( "rtrim", new StandardSQLFunction( "rtrim", Hibernate.STRING ) );
    registerFunction( "second", new StandardJDBCEscapeFunction( "second", Hibernate.INTEGER ) );
    registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
    registerFunction( "sin", new StandardJDBCEscapeFunction( "sin", Hibernate.DOUBLE ) );
    registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
    registerFunction( "%sqlstring", new VarArgsSQLFunction( Hibernate.STRING, "%sqlstring(", ",", ")" ) );
    registerFunction( "%sqlupper", new VarArgsSQLFunction( Hibernate.STRING, "%sqlupper(", ",", ")" ) );
    registerFunction( "sqrt", new StandardJDBCEscapeFunction( "SQRT", Hibernate.DOUBLE ) );
    registerFunction( "%startswith", new VarArgsSQLFunction( Hibernate.STRING, "", "%startswith", "" ) );
    // below is for Cache' that don't have str in 2007.1 there is str and we register str directly
    registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as char varying)" ) );
    registerFunction( "string", new VarArgsSQLFunction( Hibernate.STRING, "string(", ",", ")" ) );
    // note that %string is deprecated
    registerFunction( "%string", new VarArgsSQLFunction( Hibernate.STRING, "%string(", ",", ")" ) );
    registerFunction( "substr", new VarArgsSQLFunction( Hibernate.STRING, "substr(", ",", ")" ) );
    registerFunction( "substring", new VarArgsSQLFunction( Hibernate.STRING, "substring(", ",", ")" ) );
View Full Code Here

    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
    registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
    registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "octet_length(hex(?1))*4" ) );
    registerFunction( "bit_not", new StandardSQLFunction( "bit_not" ) );
    registerFunction( "bit_or", new StandardSQLFunction( "bit_or" ) );
    registerFunction( "bit_xor", new StandardSQLFunction( "bit_xor" ) );
    registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.LONG ) );
    registerFunction( "charextract", new StandardSQLFunction( "charextract", Hibernate.STRING ) );
    registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "+", ")" ) );
    registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
    registerFunction( "current_user", new NoArgSQLFunction( "current_user", Hibernate.STRING, false ) );
    registerFunction( "current_time", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "current_date", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
    registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
    registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
    registerFunction( "dba", new NoArgSQLFunction( "dba", Hibernate.STRING, true ) );
    registerFunction( "dow", new StandardSQLFunction( "dow", Hibernate.STRING ) );
    registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "date_part('?1', ?3)" ) );
    registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
    registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
    registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
    registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
    registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
    registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", Hibernate.STRING, false ) );
    registerFunction( "intextract", new StandardSQLFunction( "intextract", Hibernate.INTEGER ) );
    registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
    registerFunction( "locate", new SQLFunctionTemplate( Hibernate.LONG, "locate(?1, ?2)" ) );
    registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
    registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
    registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "lower", new StandardSQLFunction( "lower" ) );
    registerFunction( "lowercase", new StandardSQLFunction( "lowercase" ) );
    registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
    registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
    registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
    registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
    registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
    registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
    registerFunction( "random", new NoArgSQLFunction( "random", Hibernate.LONG, true ) );
    registerFunction( "randomf", new NoArgSQLFunction( "randomf", Hibernate.DOUBLE, true ) );
    registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
    registerFunction( "session_user", new NoArgSQLFunction( "session_user", Hibernate.STRING, false ) );
    registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
    registerFunction( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
    registerFunction( "squeeze", new StandardSQLFunction( "squeeze" ) );
    registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
    registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
    registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
    registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
    registerFunction( "system_user", new NoArgSQLFunction( "system_user", Hibernate.STRING, false ) );
    //registerFunction( "trim", new StandardSQLFunction( "trim", Hibernate.STRING ) );
    registerFunction( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
    registerFunction( "upper", new StandardSQLFunction( "upper" ) );
    registerFunction( "uppercase", new StandardSQLFunction( "uppercase" ) );
    registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING, false ) );
    registerFunction( "usercode", new NoArgSQLFunction( "usercode", Hibernate.STRING, true ) );
    registerFunction( "username", new NoArgSQLFunction( "username", Hibernate.STRING, true ) );
    registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", Hibernate.BYTE ) );
    registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", Hibernate.INTEGER ) );
    registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", Hibernate.BYTE ) );
    registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", Hibernate.STRING ) );
    registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
    // Casting to char of numeric values introduces space padding up to the
    // maximum width of a value for that return type.  Casting to varchar
    // does not introduce space padding.
    registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as varchar)") );
        // Ingres driver supports getGeneratedKeys but only in the following
        // form:
        // The Ingres DBMS returns only a single table key or a single object
        // key per insert statement. Ingres does not return table and object
        // keys for INSERT AS SELECT statements. Depending on the keys that are
View Full Code Here

TOP

Related Classes of org.hibernate.dialect.function.SQLFunctionTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.