Package org.hibernate.dialect.function

Examples of org.hibernate.dialect.function.StandardSQLFunction


    registerColumnType( Types.VARBINARY, "image" );
    registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
    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" ) );

View Full Code Here


        registerColumnType( Types.BLOB, "VARBINARY(4000000)" );
        registerColumnType( Types.CLOB, "VARCHAR(4000000)" );
 
    getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true");
    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
    registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
    registerFunction( "concat", new StandardSQLFunction("concat", Hibernate.STRING) );
    registerFunction( "mod", new StandardSQLFunction("mod") );
    registerFunction( "to_char", new StandardSQLFunction("to_char",Hibernate.STRING) );
    registerFunction( "to_date", new StandardSQLFunction("to_date",Hibernate.TIMESTAMP) );
    registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.TIMESTAMP, false) );
    registerFunction( "getdate", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP, false) );
    registerFunction( "nvl", new StandardSQLFunction("nvl") );

  }
View Full Code Here

    registerColumnType( Types.BLOB, "longvarbinary" );
    registerColumnType( Types.CLOB, "longvarchar" );
    registerColumnType( Types.LONGVARBINARY, "longvarbinary" );
    registerColumnType( Types.LONGVARCHAR, "longvarchar" );

    registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.INTEGER ) );
    registerFunction( "char", new StandardSQLFunction( "char", Hibernate.CHARACTER ) );
    registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
    registerFunction( "lower", new StandardSQLFunction( "lower" ) );
    registerFunction( "upper", new StandardSQLFunction( "upper" ) );
    registerFunction( "lcase", new StandardSQLFunction( "lcase" ) );
    registerFunction( "ucase", new StandardSQLFunction( "ucase" ) );
    registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
    registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
    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( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
    registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );

    registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
    registerFunction( "curdate", new NoArgSQLFunction( "curdate", Hibernate.DATE ) );
    registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP, false ) );
    registerFunction( "now", new NoArgSQLFunction( "now", Hibernate.TIMESTAMP ) );
    registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
    registerFunction( "curtime", new NoArgSQLFunction( "curtime", Hibernate.TIME ) );
    registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
    registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", Hibernate.INTEGER ) );
    registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", Hibernate.INTEGER ) );
    registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", Hibernate.INTEGER ) );
    registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
    registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
    registerFunction( "week", new StandardSQLFunction( "week", Hibernate.INTEGER ) );
    registerFunction( "quater", new StandardSQLFunction( "quater", Hibernate.INTEGER ) );
    registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
    registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
    registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
    registerFunction( "dayname", new StandardSQLFunction( "dayname", Hibernate.STRING ) );
    registerFunction( "monthname", new StandardSQLFunction( "monthname", Hibernate.STRING ) );

    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );

    registerFunction( "acos", new StandardSQLFunction( "acos", Hibernate.DOUBLE ) );
    registerFunction( "asin", new StandardSQLFunction( "asin", Hibernate.DOUBLE ) );
    registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
    registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
    registerFunction( "cot", new StandardSQLFunction( "cot", Hibernate.DOUBLE ) );
    registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
    registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
    registerFunction( "log10", new StandardSQLFunction( "log10", Hibernate.DOUBLE ) );
    registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
    registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
    registerFunction( "tan", new StandardSQLFunction( "tan", Hibernate.DOUBLE ) );
    registerFunction( "pi", new NoArgSQLFunction( "pi", Hibernate.DOUBLE ) );
    registerFunction( "rand", new StandardSQLFunction( "rand", Hibernate.FLOAT ) );

    registerFunction( "radians", new StandardSQLFunction( "radians", Hibernate.DOUBLE ) );
    registerFunction( "degrees", new StandardSQLFunction( "degrees", Hibernate.DOUBLE ) );
    registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic" ) );

    registerFunction( "ceiling", new StandardSQLFunction( "ceiling" ) );
    registerFunction( "floor", new StandardSQLFunction( "floor" ) );

    // Multi-param dialect functions...
    registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );

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

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

    registerColumnType( Types.VARBINARY, "varbinary" );
    registerColumnType( Types.NUMERIC, "numeric" );
    registerColumnType( Types.BLOB, "blob" );
    registerColumnType( Types.CLOB, "clob" );

    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction( "abs", new StandardSQLFunction("abs") );
    registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
    registerFunction( "length", new StandardSQLFunction( "length", Hibernate.INTEGER ) );
    registerFunction( "round", new StandardSQLFunction( "round", Hibernate.INTEGER ) );
    registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );
    registerFunction( "least", new StandardSQLFunction("least") );
    registerFunction( "greatest", new StandardSQLFunction("greatest") );
    registerFunction( "user", new StandardSQLFunction( "user", Hibernate.STRING ) );
    registerFunction( "concat", new StandardSQLFunction( "concat", Hibernate.STRING ) );

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

  protected void registerReverseHibernateTypeMappings() {
  }

  protected void registerFunctions() {
    registerFunction( "abs", new StandardSQLFunction("abs") );
    registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

    registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
    registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
    registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
    registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
    registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
    registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
    registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
    registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
    registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
    registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );

    registerFunction( "round", new StandardSQLFunction("round") );
    registerFunction( "trunc", new StandardSQLFunction("trunc") );
    registerFunction( "ceil", new StandardSQLFunction("ceil") );
    registerFunction( "floor", new StandardSQLFunction("floor") );

    registerFunction( "chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
    registerFunction( "initcap", new StandardSQLFunction("initcap") );
    registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
    registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
    registerFunction( "soundex", new StandardSQLFunction("soundex") );
    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
    registerFunction( "length", new StandardSQLFunction("length", Hibernate.LONG) );

    registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
    registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.TIMESTAMP) );

    registerFunction( "current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
    registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", Hibernate.TIME, false) );
    registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );

    registerFunction( "last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
    registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.DATE, false) );
    registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", Hibernate.TIMESTAMP, false) );
    registerFunction( "uid", new NoArgSQLFunction("uid", Hibernate.INTEGER, false) );
    registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );

    registerFunction( "rowid", new NoArgSQLFunction("rowid", Hibernate.LONG, false) );
    registerFunction( "rownum", new NoArgSQLFunction("rownum", Hibernate.LONG, false) );

    // Multi-param string dialect functions...
    registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
    registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.INTEGER) );
    registerFunction( "instrb", new StandardSQLFunction("instrb", Hibernate.INTEGER) );
    registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
    registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
    registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
    registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
    registerFunction( "substrb", new StandardSQLFunction("substrb", Hibernate.STRING) );
    registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );

    registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
    registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "instr(?2,?1)" ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "vsize(?1)*8" ) );
    registerFunction( "coalesce", new NvlFunction() );

    // Multi-param numeric dialect functions...
    registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.FLOAT) );
    registerFunction( "log", new StandardSQLFunction("log", Hibernate.INTEGER) );
    registerFunction( "mod", new StandardSQLFunction("mod", Hibernate.INTEGER) );
    registerFunction( "nvl", new StandardSQLFunction("nvl") );
    registerFunction( "nvl2", new StandardSQLFunction("nvl2") );
    registerFunction( "power", new StandardSQLFunction("power", Hibernate.FLOAT) );

    // Multi-param date dialect functions...
    registerFunction( "add_months", new StandardSQLFunction("add_months", Hibernate.DATE) );
    registerFunction( "months_between", new StandardSQLFunction("months_between", Hibernate.FLOAT) );
    registerFunction( "next_day", new StandardSQLFunction("next_day", Hibernate.DATE) );

    registerFunction( "str", new StandardSQLFunction("to_char", Hibernate.STRING) );
  }
View Full Code Here

    getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
    //getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);

    getDefaultProperties().setProperty( Environment.USE_SQL_COMMENTS, "false" );

    registerFunction( "abs", new StandardSQLFunction( "abs" ) );
    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 StandardSQLFunction( "length", 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(", ",", ")" ) );
    registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.TIMESTAMP, false ) );
    registerFunction( "tan", new StandardJDBCEscapeFunction( "tan", Hibernate.DOUBLE ) );
    registerFunction( "timestampadd", new StandardJDBCEscapeFunction( "timestampadd", Hibernate.DOUBLE ) );
    registerFunction( "timestampdiff", new StandardJDBCEscapeFunction( "timestampdiff", Hibernate.DOUBLE ) );
    registerFunction( "tochar", new VarArgsSQLFunction( Hibernate.STRING, "tochar(", ",", ")" ) );
    registerFunction( "to_char", new VarArgsSQLFunction( Hibernate.STRING, "to_char(", ",", ")" ) );
    registerFunction( "todate", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
    registerFunction( "to_date", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
    registerFunction( "tonumber", new StandardSQLFunction( "tonumber" ) );
    registerFunction( "to_number", new StandardSQLFunction( "tonumber" ) );
    // TRIM(end_keyword string-expression-1 FROM string-expression-2)
    // use Hibernate implementation "From" is one of the parameters they pass in position ?3
    //registerFunction( "trim", new SQLFunctionTemplate(Hibernate.STRING, "trim(?1 ?2 from ?3)") );
    registerFunction( "truncate", new StandardJDBCEscapeFunction( "truncate", Hibernate.STRING ) );
    registerFunction( "ucase", new StandardJDBCEscapeFunction( "ucase", Hibernate.STRING ) );
    registerFunction( "upper", new StandardSQLFunction( "upper" ) );
    // %upper is deprecated
    registerFunction( "%upper", new StandardSQLFunction( "%upper" ) );
    registerFunction( "user", new StandardJDBCEscapeFunction( "user", Hibernate.STRING ) );
    registerFunction( "week", new StandardJDBCEscapeFunction( "user", Hibernate.INTEGER ) );
    registerFunction( "xmlconcat", new VarArgsSQLFunction( Hibernate.STRING, "xmlconcat(", ",", ")" ) );
    registerFunction( "xmlelement", new VarArgsSQLFunction( Hibernate.STRING, "xmlelement(", ",", ")" ) );
    // xmlforest requires a new kind of function constructor
View Full Code Here

    registerColumnType( Types.VARBINARY, "varbinary($l)" );
    registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
    registerColumnType( Types.BLOB, "image" );
    registerColumnType( Types.CLOB, "text" );

    registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
    registerFunction( "char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
    registerFunction( "len", new StandardSQLFunction("len", Hibernate.LONG) );
    registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "str", new StandardSQLFunction("str", Hibernate.STRING) );
    registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
    registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
    registerFunction( "reverse", new StandardSQLFunction("reverse") );
    registerFunction( "space", new StandardSQLFunction("space", Hibernate.STRING) );

    registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING) );

    registerFunction( "current_timestamp", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
    registerFunction( "current_time", new NoArgSQLFunction("getdate", Hibernate.TIME) );
    registerFunction( "current_date", new NoArgSQLFunction("getdate", Hibernate.DATE) );

    registerFunction( "getdate", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
    registerFunction( "getutcdate", new NoArgSQLFunction("getutcdate", Hibernate.TIMESTAMP) );
    registerFunction( "day", new StandardSQLFunction("day", Hibernate.INTEGER) );
    registerFunction( "month", new StandardSQLFunction("month", Hibernate.INTEGER) );
    registerFunction( "year", new StandardSQLFunction("year", Hibernate.INTEGER) );
    registerFunction( "datename", new StandardSQLFunction("datename", Hibernate.STRING) );

    registerFunction( "abs", new StandardSQLFunction("abs") );
    registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

    registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
    registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
    registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
    registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
    registerFunction( "cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
    registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE) );
    registerFunction( "log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
    registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
    registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
    registerFunction( "square", new StandardSQLFunction("square") );
    registerFunction( "rand", new StandardSQLFunction("rand", Hibernate.FLOAT) );

    registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
    registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );

    registerFunction( "round", new StandardSQLFunction("round") );
    registerFunction( "ceiling", new StandardSQLFunction("ceiling") );
    registerFunction( "floor", new StandardSQLFunction("floor") );

    registerFunction( "isnull", new StandardSQLFunction("isnull") );

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

    registerFunction( "length", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
    registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "ltrim(rtrim(?1))") );
    registerFunction( "locate", new CharIndexFunction() );

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

         * characteristics. If StandardSQLFunction(...) is used, the RDMS BIF
         * name and the return type (if any) is specified.  If
         * SQLFunctionTemplate(...) is used, the return type and a template
         * string is provided, plus an optional hasParenthesesIfNoArgs flag.
         */
    registerFunction( "abs", new StandardSQLFunction("abs") );
    registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

    registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
    registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.INTEGER) );
    registerFunction("character_length", new StandardSQLFunction("character_length", Hibernate.INTEGER) );
    registerFunction("length", new StandardSQLFunction("length", Hibernate.INTEGER) );

    // The RDMS concat() function only supports 2 parameters
    registerFunction( "concat", new SQLFunctionTemplate(Hibernate.STRING, "concat(?1, ?2)") );
    registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.STRING) );
    registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
    registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
    registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
    registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );

    registerFunction("lcase", new StandardSQLFunction("lcase") );
    registerFunction("lower", new StandardSQLFunction("lower") );
    registerFunction("ltrim", new StandardSQLFunction("ltrim") );
    registerFunction("reverse", new StandardSQLFunction("reverse") );
    registerFunction("rtrim", new StandardSQLFunction("rtrim") );

    // RDMS does not directly support the trim() function, we use rtrim() and ltrim()
    registerFunction("trim", new SQLFunctionTemplate(Hibernate.INTEGER, "ltrim(rtrim(?1))" ) );
    registerFunction("soundex", new StandardSQLFunction("soundex") );
    registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING) );
    registerFunction("ucase", new StandardSQLFunction("ucase") );
    registerFunction("upper", new StandardSQLFunction("upper") );

    registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
    registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
    registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
    registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
    registerFunction("cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
    registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
    registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
    registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
    registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
    registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
    registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction("sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
    registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
    registerFunction("tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );

    registerFunction( "round", new StandardSQLFunction("round") );
    registerFunction( "trunc", new StandardSQLFunction("trunc") );
    registerFunction( "ceil", new StandardSQLFunction("ceil") );
    registerFunction( "floor", new StandardSQLFunction("floor") );

    registerFunction( "chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
    registerFunction( "initcap", new StandardSQLFunction("initcap") );

    registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );

    registerFunction( "current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
    registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", Hibernate.TIME, false) );
    registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
    registerFunction("curdate", new NoArgSQLFunction("curdate",Hibernate.DATE) );
    registerFunction("curtime", new NoArgSQLFunction("curtime",Hibernate.TIME) );
    registerFunction("days", new StandardSQLFunction("days",Hibernate.INTEGER) );
    registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth",Hibernate.INTEGER) );
    registerFunction("dayname", new StandardSQLFunction("dayname",Hibernate.STRING) );
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek",Hibernate.INTEGER) );
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear",Hibernate.INTEGER) );
    registerFunction("hour", new StandardSQLFunction("hour",Hibernate.INTEGER) );
    registerFunction("last_day", new StandardSQLFunction("last_day",Hibernate.DATE) );
    registerFunction("microsecond", new StandardSQLFunction("microsecond",Hibernate.INTEGER) );
    registerFunction("minute", new StandardSQLFunction("minute",Hibernate.INTEGER) );
    registerFunction("month", new StandardSQLFunction("month",Hibernate.INTEGER) );
    registerFunction("monthname", new StandardSQLFunction("monthname",Hibernate.STRING) );
    registerFunction("now", new NoArgSQLFunction("now",Hibernate.TIMESTAMP) );
    registerFunction("quarter", new StandardSQLFunction("quarter",Hibernate.INTEGER) );
    registerFunction("second", new StandardSQLFunction("second",Hibernate.INTEGER) );
    registerFunction("time", new StandardSQLFunction("time",Hibernate.TIME) );
    registerFunction("timestamp", new StandardSQLFunction("timestamp",Hibernate.TIMESTAMP) );
    registerFunction("week", new StandardSQLFunction("week",Hibernate.INTEGER) );
    registerFunction("year", new StandardSQLFunction("year",Hibernate.INTEGER) );

    registerFunction("atan2", new StandardSQLFunction("atan2",Hibernate.DOUBLE) );
    registerFunction( "mod", new StandardSQLFunction("mod",Hibernate.INTEGER) );
    registerFunction( "nvl", new StandardSQLFunction("nvl") );
    registerFunction( "power", new StandardSQLFunction("power", Hibernate.DOUBLE) );

    /**
     * For a list of column types to register, see section A-1
     * in 7862 7395, the Unisys JDBC manual.
     *
 
View Full Code Here

    registerColumnType( Types.TIMESTAMP, "timestamp" );
    registerColumnType( Types.VARBINARY, "varchar($l) for bit data" );
    registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
    registerColumnType( Types.BLOB, "blob($l)" );
    registerColumnType( Types.CLOB, "clob($l)" );
    registerFunction("abs", new StandardSQLFunction("abs") );
    registerFunction("absval", new StandardSQLFunction("absval") );
    registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

    registerFunction("ceiling", new StandardSQLFunction("ceiling") );
    registerFunction("ceil", new StandardSQLFunction("ceil") );
    registerFunction("floor", new StandardSQLFunction("floor") );
    registerFunction("round", new StandardSQLFunction("round") );

    registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
    registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
    registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
    registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
    registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
    registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
    registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction("float", new StandardSQLFunction("float", Hibernate.DOUBLE) );
    registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
    registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
    registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
    registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
    registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
    registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
    registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction("stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
    registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
    registerFunction("variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );

    registerFunction("julian_day", new StandardSQLFunction("julian_day", Hibernate.INTEGER) );
    registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) );
    registerFunction("midnight_seconds", new StandardSQLFunction("midnight_seconds", Hibernate.INTEGER) );
    registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
    registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
    registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
    registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
    registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
    registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
    registerFunction("current_date", new NoArgSQLFunction("current date", Hibernate.DATE, false) );
    registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
    registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
    registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
    registerFunction("dayofweek_iso", new StandardSQLFunction("dayofweek_iso", Hibernate.INTEGER) );
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
    registerFunction("days", new StandardSQLFunction("days", Hibernate.LONG) );
    registerFunction("current_time", new NoArgSQLFunction("current time", Hibernate.TIME, false) );
    registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
    registerFunction("current_timestamp", new NoArgSQLFunction("current timestamp", Hibernate.TIMESTAMP, false) );
    registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
    registerFunction("timestamp_iso", new StandardSQLFunction("timestamp_iso", Hibernate.TIMESTAMP) );
    registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
    registerFunction("week_iso", new StandardSQLFunction("week_iso", Hibernate.INTEGER) );
    registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );

    registerFunction("double", new StandardSQLFunction("double", Hibernate.DOUBLE) );
    registerFunction("varchar", new StandardSQLFunction("varchar", Hibernate.STRING) );
    registerFunction("real", new StandardSQLFunction("real", Hibernate.FLOAT) );
    registerFunction("bigint", new StandardSQLFunction("bigint", Hibernate.LONG) );
    registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
    registerFunction("integer", new StandardSQLFunction("integer", Hibernate.INTEGER) );
    registerFunction("smallint", new StandardSQLFunction("smallint", Hibernate.SHORT) );

    registerFunction("digits", new StandardSQLFunction("digits", Hibernate.STRING) );
    registerFunction("chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
    registerFunction("upper", new StandardSQLFunction("upper") );
    registerFunction("lower", new StandardSQLFunction("lower") );
    registerFunction("ucase", new StandardSQLFunction("ucase") );
    registerFunction("lcase", new StandardSQLFunction("lcase") );
    registerFunction("length", new StandardSQLFunction("length", Hibernate.LONG) );
    registerFunction("ltrim", new StandardSQLFunction("ltrim") );
    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, "", "||", "") );

View Full Code Here

    // support this overloaded version.
    getDefaultProperties().setProperty(Environment.USE_GET_GENERATED_KEYS, "false");
    getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true");
    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);

    registerFunction( "abs", new StandardSQLFunction("abs") );
    registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

    registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
    registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
    registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
    registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
    registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
    registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
    registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
    registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
    registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
    registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
    registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
    registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
    registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
    registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );

    registerFunction( "round", new StandardSQLFunction("round") );
    registerFunction( "trunc", new StandardSQLFunction("trunc") );
    registerFunction( "ceil", new StandardSQLFunction("ceil") );
    registerFunction( "floor", new StandardSQLFunction("floor") );

    registerFunction( "chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
    registerFunction( "initcap", new StandardSQLFunction("initcap") );
    registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "ltrim", new StandardSQLFunction("ltrim") );
    registerFunction( "rtrim", new StandardSQLFunction("rtrim") );
    registerFunction( "soundex", new StandardSQLFunction("soundex") );
    registerFunction( "upper", new StandardSQLFunction("upper") );
    registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
    registerFunction( "length", new StandardSQLFunction("length", Hibernate.LONG) );

    registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
    registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.TIMESTAMP) );

    registerFunction( "current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
    registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", Hibernate.TIME, false) );
    registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
   
    registerFunction( "last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
    registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.DATE, false) );
    registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", Hibernate.TIMESTAMP, false) );
    registerFunction( "uid", new NoArgSQLFunction("uid", Hibernate.INTEGER, false) );
    registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );

    registerFunction( "rowid", new NoArgSQLFunction("rowid", Hibernate.LONG, false) );
    registerFunction( "rownum", new NoArgSQLFunction("rownum", Hibernate.LONG, false) );

    // Multi-param string dialect functions...
    registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
    registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.INTEGER) );
    registerFunction( "instrb", new StandardSQLFunction("instrb", Hibernate.INTEGER) );
    registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
    registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
    registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
    registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
    registerFunction( "substrb", new StandardSQLFunction("substrb", Hibernate.STRING) );
    registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );

    registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
    registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "instr(?2,?1)" ) );
    registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "vsize(?1)*8" ) );
    registerFunction( "coalesce", new NvlFunction() );

    // Multi-param numeric dialect functions...
    registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.FLOAT) );
    registerFunction( "log", new StandardSQLFunction("log", Hibernate.INTEGER) );
    registerFunction( "mod", new StandardSQLFunction("mod", Hibernate.INTEGER) );
    registerFunction( "nvl", new StandardSQLFunction("nvl") );
    registerFunction( "nvl2", new StandardSQLFunction("nvl2") );
    registerFunction( "power", new StandardSQLFunction("power", Hibernate.FLOAT) );

    // Multi-param date dialect functions...
    registerFunction( "add_months", new StandardSQLFunction("add_months", Hibernate.DATE) );
    registerFunction( "months_between", new StandardSQLFunction("months_between", Hibernate.FLOAT) );
    registerFunction( "next_day", new StandardSQLFunction("next_day", Hibernate.DATE) );

    registerFunction( "str", new StandardSQLFunction("to_char", Hibernate.STRING) );
  }
View Full Code Here

TOP

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

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.