Package org.hibernate.dialect.function

Examples of org.hibernate.dialect.function.StandardSQLFunction


  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


    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.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

    // 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)") );
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.NUMERIC, "numeric" );
    //HSQL has no Blob/Clob support .... but just put these here for now!
    registerColumnType( Types.BLOB, "longvarbinary" );
    registerColumnType( Types.CLOB, "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

       
        // select topic, syntax from information_schema.help
        // where section like 'Function%' order by section, topic

//        registerFunction("abs", new StandardSQLFunction("abs"));
        registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE));
        registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE));
        registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE));
        registerFunction("atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE));
        registerFunction("bitand", new StandardSQLFunction("bitand", Hibernate.INTEGER));
        registerFunction("bitor", new StandardSQLFunction("bitor", Hibernate.INTEGER));
        registerFunction("bitxor", new StandardSQLFunction("bitxor", Hibernate.INTEGER));
        registerFunction("ceiling", new StandardSQLFunction("ceiling", 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("floor", new StandardSQLFunction("floor", Hibernate.DOUBLE));
        registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE));
        registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE));
//        registerFunction("mod", new StandardSQLFunction("mod", Hibernate.INTEGER));
        registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE));
        registerFunction("power", new StandardSQLFunction("power", Hibernate.DOUBLE));
        registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE));
        registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE));
        registerFunction("round", new StandardSQLFunction("round", Hibernate.DOUBLE));
        registerFunction("roundmagic", new StandardSQLFunction("roundmagic", Hibernate.DOUBLE));
        registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER));
        registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE));
//        registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE));
        registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE));
        registerFunction("truncate", new StandardSQLFunction("truncate", Hibernate.DOUBLE));

        registerFunction("compress", new StandardSQLFunction("compress", Hibernate.BINARY));
        registerFunction("expand", new StandardSQLFunction("compress", Hibernate.BINARY));
        registerFunction("decrypt", new StandardSQLFunction("decrypt", Hibernate.BINARY));
        registerFunction("encrypt", new StandardSQLFunction("encrypt", Hibernate.BINARY));
        registerFunction("hash", new StandardSQLFunction("hash", Hibernate.BINARY));

        registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER));
//        registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.INTEGER));
        registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER));
        registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "(", "||", ")"));
        registerFunction("difference", new StandardSQLFunction("difference", Hibernate.INTEGER));
        registerFunction("hextoraw", new StandardSQLFunction("hextoraw", Hibernate.STRING));
        registerFunction("lower", new StandardSQLFunction("lower", Hibernate.STRING));
        registerFunction("insert", new StandardSQLFunction("lower", Hibernate.STRING));
        registerFunction("left", new StandardSQLFunction("left", Hibernate.STRING));
//        registerFunction("length", new StandardSQLFunction("length", Hibernate.INTEGER));
//        registerFunction("locate", new StandardSQLFunction("locate", Hibernate.INTEGER));
//        registerFunction("lower", new StandardSQLFunction("lower", Hibernate.STRING));
        registerFunction("lcase", new StandardSQLFunction("lcase", Hibernate.STRING));
        registerFunction("ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING));
        registerFunction("octet_length", new StandardSQLFunction("octet_length", Hibernate.INTEGER));
        registerFunction("position", new StandardSQLFunction("position", Hibernate.INTEGER));
        registerFunction("rawtohex", new StandardSQLFunction("rawtohex", Hibernate.STRING));
        registerFunction("repeat", new StandardSQLFunction("repeat", Hibernate.STRING));
        registerFunction("replace", new StandardSQLFunction("replace", Hibernate.STRING));
        registerFunction("right", new StandardSQLFunction("right", Hibernate.STRING));
        registerFunction("rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING));
        registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING));
        registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING));
        registerFunction("stringencode", new StandardSQLFunction("stringencode", Hibernate.STRING));
        registerFunction("stringdecode", new StandardSQLFunction("stringdecode", Hibernate.STRING));
//        registerFunction("substring", new StandardSQLFunction("substring", Hibernate.STRING));
//        registerFunction("upper", new StandardSQLFunction("upper", Hibernate.STRING));
        registerFunction("ucase", new StandardSQLFunction("ucase", Hibernate.STRING));

        registerFunction("stringtoutf8", new StandardSQLFunction("stringtoutf8", Hibernate.BINARY));
        registerFunction("utf8tostring", new StandardSQLFunction("utf8tostring", Hibernate.STRING));

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

        registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE));
        registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME));
        registerFunction("curtimestamp", new NoArgSQLFunction("curtimestamp", Hibernate.TIME));
View Full Code Here

    // 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)") );
View Full Code Here

    registerColumnType( Types.BINARY, "BLOB($1)" );
    registerColumnType( Types.NUMERIC, "NUMERIC(19, $l)" );
    registerColumnType( Types.BLOB, "BLOB($l)" );
    registerColumnType( Types.CLOB, "NCLOB($l)" );

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

    registerFunction("dacos", new StandardSQLFunction("dacos", Hibernate.DOUBLE) );
    registerFunction("acos", new StandardSQLFunction("dacos", Hibernate.DOUBLE) );
    registerFunction("dasin", new StandardSQLFunction("dasin", Hibernate.DOUBLE) );
    registerFunction("asin", new StandardSQLFunction("dasin", Hibernate.DOUBLE) );
    registerFunction("datan", new StandardSQLFunction("datan", Hibernate.DOUBLE) );
    registerFunction("atan", new StandardSQLFunction("datan", Hibernate.DOUBLE) );
    registerFunction("datan2", new StandardSQLFunction("datan2", Hibernate.DOUBLE) );
    registerFunction("atan2", new StandardSQLFunction("datan2", Hibernate.DOUBLE) );
    registerFunction("dcos", new StandardSQLFunction("dcos", Hibernate.DOUBLE) );
    registerFunction("cos", new StandardSQLFunction("dcos", Hibernate.DOUBLE) );
    registerFunction("dcot", new StandardSQLFunction("dcot", Hibernate.DOUBLE) );
    registerFunction("cot", new StandardSQLFunction("dcot", Hibernate.DOUBLE) );
    registerFunction("ddegrees", new StandardSQLFunction("ddegrees", Hibernate.DOUBLE) );
    registerFunction("degrees", new StandardSQLFunction("ddegrees", Hibernate.DOUBLE) );
    registerFunction("dexp", new StandardSQLFunction("dexp", Hibernate.DOUBLE) );
    registerFunction("exp", new StandardSQLFunction("dexp", Hibernate.DOUBLE) );
    registerFunction("dlog", new StandardSQLFunction("dlog", Hibernate.DOUBLE) );
    registerFunction("log", new StandardSQLFunction("dlog", Hibernate.DOUBLE) );
    registerFunction("dlog10", new StandardSQLFunction("dlog10", Hibernate.DOUBLE) );
    registerFunction("log10", new StandardSQLFunction("dlog10", Hibernate.DOUBLE) );
    registerFunction("dradian", new StandardSQLFunction("dradian", Hibernate.DOUBLE) );
    registerFunction("radian", new StandardSQLFunction("dradian", Hibernate.DOUBLE) );
    registerFunction("dsin", new StandardSQLFunction("dsin", Hibernate.DOUBLE) );
    registerFunction("sin", new StandardSQLFunction("dsin", Hibernate.DOUBLE) );
    registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
    registerFunction("dsqrt", new StandardSQLFunction("dsqrt", Hibernate.DOUBLE) );
    registerFunction("sqrt", new StandardSQLFunction("dsqrt", Hibernate.DOUBLE) );
    registerFunction("dtan", new StandardSQLFunction("dtan", Hibernate.DOUBLE) );
    registerFunction("tan", new StandardSQLFunction("dtan", Hibernate.DOUBLE) );
    registerFunction("dpower", new StandardSQLFunction("dpower") );
    registerFunction("power", new StandardSQLFunction("dpower") );

    registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
    registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
    registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
    registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );


    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("ascii_char", new StandardSQLFunction("ascii_char", Hibernate.CHARACTER) );
    registerFunction("ascii_code", new StandardSQLFunction("ascii_code", Hibernate.STRING));
    registerFunction("unicode_char", new StandardSQLFunction("unicode_char", Hibernate.LONG));
    registerFunction("unicode_code", new StandardSQLFunction("unicode_code", Hibernate.STRING));
    registerFunction("upper", new StandardSQLFunction("upper") );
    registerFunction("lower", new StandardSQLFunction("lower") );
    registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.LONG) );
    registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.STRING));

    getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true");
    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, "50");
  }
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.