List of usage examples for org.hibernate.dialect.function SQLFunctionTemplate SQLFunctionTemplate
public SQLFunctionTemplate(Type type, String template)
From source file:com.siemens.scr.avt.ad.hibernate.DB2XMLDialect.java
License:Open Source License
public DB2XMLDialect() { super();/*w w w . java2 s. co m*/ registerColumnType(Types.BIT, "smallint"); registerColumnType(Types.BIGINT, "bigint"); registerColumnType(Types.SMALLINT, "smallint"); registerColumnType(Types.TINYINT, "smallint"); registerColumnType(Types.INTEGER, "integer"); registerColumnType(Types.CHAR, "char(1)"); registerColumnType(Types.VARCHAR, "varchar($l)"); registerColumnType(Types.FLOAT, "float"); registerColumnType(Types.DOUBLE, "double"); registerColumnType(Types.DATE, "date"); registerColumnType(Types.TIME, "time"); 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)"); registerColumnType(Types.SQLXML, "XML"); 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, "", "||", "")); registerFunction("str", new SQLFunctionTemplate(Hibernate.STRING, "rtrim(char(?1))")); registerKeyword("current"); registerKeyword("date"); registerKeyword("time"); registerKeyword("timestamp"); registerKeyword("fetch"); registerKeyword("first"); registerKeyword("rows"); registerKeyword("only"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); }
From source file:com.syndiceo.PostgreSQLDialect.java
License:Open Source License
public PostgreSQLDialect() { super();// w w w.j a v a 2s . co m registerColumnType(Types.BIT, "bool"); registerColumnType(Types.BIGINT, "int8"); registerColumnType(Types.SMALLINT, "int2"); registerColumnType(Types.TINYINT, "int2"); registerColumnType(Types.INTEGER, "int4"); registerColumnType(Types.CHAR, "char(1)"); registerColumnType(Types.VARCHAR, "varchar($l)"); registerColumnType(Types.FLOAT, "float4"); registerColumnType(Types.DOUBLE, "float8"); registerColumnType(Types.DATE, "date"); registerColumnType(Types.TIME, "time"); registerColumnType(Types.TIMESTAMP, "timestamp"); registerColumnType(Types.VARBINARY, "bytea"); registerColumnType(Types.BINARY, "bytea"); registerColumnType(Types.LONGVARCHAR, "text"); registerColumnType(Types.LONGVARBINARY, "bytea"); registerColumnType(Types.CLOB, "text"); registerColumnType(Types.BLOB, "oid"); registerColumnType(Types.NUMERIC, "numeric($p, $s)"); registerColumnType(Types.OTHER, "uuid"); registerFunction("abs", new StandardSQLFunction("abs")); registerFunction("sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER)); registerFunction("acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE)); registerFunction("asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE)); registerFunction("atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE)); registerFunction("cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE)); registerFunction("cot", new StandardSQLFunction("cot", StandardBasicTypes.DOUBLE)); registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE)); registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE)); registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.DOUBLE)); registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE)); registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE)); registerFunction("cbrt", new StandardSQLFunction("cbrt", StandardBasicTypes.DOUBLE)); registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE)); registerFunction("radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE)); registerFunction("degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE)); registerFunction("stddev", new StandardSQLFunction("stddev", StandardBasicTypes.DOUBLE)); registerFunction("variance", new StandardSQLFunction("variance", StandardBasicTypes.DOUBLE)); registerFunction("random", new NoArgSQLFunction("random", StandardBasicTypes.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", StandardBasicTypes.CHARACTER)); registerFunction("lower", new StandardSQLFunction("lower")); registerFunction("upper", new StandardSQLFunction("upper")); registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); registerFunction("initcap", new StandardSQLFunction("initcap")); registerFunction("to_ascii", new StandardSQLFunction("to_ascii")); registerFunction("quote_ident", new StandardSQLFunction("quote_ident", StandardBasicTypes.STRING)); registerFunction("quote_literal", new StandardSQLFunction("quote_literal", StandardBasicTypes.STRING)); registerFunction("md5", new StandardSQLFunction("md5")); registerFunction("ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER)); registerFunction("char_length", new StandardSQLFunction("char_length", StandardBasicTypes.LONG)); registerFunction("bit_length", new StandardSQLFunction("bit_length", StandardBasicTypes.LONG)); registerFunction("octet_length", new StandardSQLFunction("octet_length", StandardBasicTypes.LONG)); registerFunction("age", new StandardSQLFunction("age")); registerFunction("current_date", new NoArgSQLFunction("current_date", StandardBasicTypes.DATE, false)); registerFunction("current_time", new NoArgSQLFunction("current_time", StandardBasicTypes.TIME, false)); registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIMESTAMP, false)); registerFunction("date_trunc", new StandardSQLFunction("date_trunc", StandardBasicTypes.TIMESTAMP)); registerFunction("localtime", new NoArgSQLFunction("localtime", StandardBasicTypes.TIME, false)); registerFunction("localtimestamp", new NoArgSQLFunction("localtimestamp", StandardBasicTypes.TIMESTAMP, false)); registerFunction("now", new NoArgSQLFunction("now", StandardBasicTypes.TIMESTAMP)); registerFunction("timeofday", new NoArgSQLFunction("timeofday", StandardBasicTypes.STRING)); registerFunction("current_user", new NoArgSQLFunction("current_user", StandardBasicTypes.STRING, false)); registerFunction("session_user", new NoArgSQLFunction("session_user", StandardBasicTypes.STRING, false)); registerFunction("user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false)); registerFunction("current_database", new NoArgSQLFunction("current_database", StandardBasicTypes.STRING, true)); registerFunction("current_schema", new NoArgSQLFunction("current_schema", StandardBasicTypes.STRING, true)); registerFunction("to_char", new StandardSQLFunction("to_char", StandardBasicTypes.STRING)); registerFunction("to_date", new StandardSQLFunction("to_date", StandardBasicTypes.DATE)); registerFunction("to_timestamp", new StandardSQLFunction("to_timestamp", StandardBasicTypes.TIMESTAMP)); registerFunction("to_number", new StandardSQLFunction("to_number", StandardBasicTypes.BIG_DECIMAL)); registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "(", "||", ")")); registerFunction("locate", new PositionSubstringFunction()); registerFunction("str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as varchar)")); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); getDefaultProperties().setProperty(Environment.NON_CONTEXTUAL_LOB_CREATION, "true"); }
From source file:com.wiiyaya.framework.provider.tools.hibernate.MySQL5InnoDBDialectPlus.java
License:Apache License
public MySQL5InnoDBDialectPlus() { super();//from ww w . j a v a 2 s .com registerFunction("regexp_like", new SQLFunctionTemplate(StandardBasicTypes.BOOLEAN, "?1 REGEXP ?2")); registerFunction("add_minutes", new SQLFunctionTemplate(StandardBasicTypes.TIMESTAMP, "date_add(?1, INTERVAL ?2 MINUTE)")); }
From source file:com.xpn.xwiki.store.hibernate.WikiSQLServerDialect.java
License:Open Source License
/** * constructor.//from ww w .jav a2 s . c o m */ public WikiSQLServerDialect() { super(); registerFunction("str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as varchar)")); }
From source file:edu.kit.ipd.sonar.server.SQLiteDialect.java
License:Open Source License
public SQLiteDialect() { super();//from www .j ava 2s . co m registerColumnType(Types.BIT, "integer"); registerColumnType(Types.TINYINT, "tinyint"); registerColumnType(Types.SMALLINT, "smallint"); registerColumnType(Types.INTEGER, "integer"); registerColumnType(Types.BIGINT, "bigint"); registerColumnType(Types.FLOAT, "float"); registerColumnType(Types.REAL, "real"); registerColumnType(Types.DOUBLE, "double"); registerColumnType(Types.NUMERIC, "numeric"); registerColumnType(Types.DECIMAL, "decimal"); registerColumnType(Types.CHAR, "char"); registerColumnType(Types.VARCHAR, "varchar"); registerColumnType(Types.LONGVARCHAR, "longvarchar"); registerColumnType(Types.DATE, "date"); registerColumnType(Types.TIME, "time"); registerColumnType(Types.TIMESTAMP, "timestamp"); registerColumnType(Types.BINARY, "blob"); registerColumnType(Types.VARBINARY, "bl ob"); registerColumnType(Types.LONGVARBINARY, "blob"); // registerColumnType(Types.NULL, "null"); registerColumnType(Types.BLOB, "blob"); registerColumnType(Types.CLOB, "clob"); registerColumnType(Types.BOOLEAN, "integer"); registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "")); registerFunction("mod", new SQLFunctionTemplate(Hibernate.INTEGER, "?1 % ?2")); registerFunction("substr", new StandardSQLFunction("substr", Hibernate.STRING)); registerFunction("substring", new StandardSQLFunction("substr", Hibernate.STRING)); }
From source file:hacks.VirtuosoSybaseDialect.java
License:Open Source License
public VirtuosoSybaseDialect() { super();//from w ww. j ava 2s . c o m registerColumnType(Types.BIT, "smallint"); //Sybase BIT type does not support null values //registerColumnType( Types.BIGINT, "numeric(19,0)" ); registerColumnType(Types.BIGINT, "decimal"); registerColumnType(Types.SMALLINT, "smallint"); registerColumnType(Types.TINYINT, "tinyint"); registerColumnType(Types.INTEGER, "int"); registerColumnType(Types.CHAR, "char(1)"); registerColumnType(Types.VARCHAR, "varchar($l)"); registerColumnType(Types.FLOAT, "float"); registerColumnType(Types.DOUBLE, "double precision"); registerColumnType(Types.DATE, "datetime"); registerColumnType(Types.TIME, "datetime"); registerColumnType(Types.TIMESTAMP, "datetime"); 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); }
From source file:nl.lawinegevaar.jaytalk2014.jpajooq.AlternativeFirebirdDialect.java
License:Open Source License
public AlternativeFirebirdDialect() { registerFunction("substring", new SQLFunctionTemplate(StandardBasicTypes.STRING, "substring(?1 from ?2 for ?3)")); }
From source file:org.j2free.jpa.J2FreeMySQLDialect.java
License:Apache License
/** * /*from w w w. ja v a 2s . c o m*/ */ public J2FreeMySQLDialect() { super(); registerFunction("date_sub_interval", new SQLFunctionTemplate(Hibernate.DATE, "DATE_SUB(?1, INTERVAL ?2 ?3)")); registerFunction("days_ago_date", new SQLFunctionTemplate(Hibernate.DATE, "DATE_SUB(CURRENT_DATE, INTERVAL ?1 DAY)")); registerFunction("days_ago_timestamp", new SQLFunctionTemplate(Hibernate.DATE, "DATE_SUB(CURRENT_TIMESTAMP, INTERVAL ?1 DAY)")); registerFunction("date_diff", new SQLFunctionTemplate(Hibernate.INTEGER, "DATEDIFF(?1,?2)")); }
From source file:org.jboss.as.quickstart.hibernate4.util.vertica.VerticaDialect6.java
License:Open Source License
protected void registerFunctions() { registerFunction("abs", new StandardSQLFunction("abs")); registerFunction("sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER)); registerFunction("acos", new StandardSQLFunction("acos", StandardBasicTypes.DOUBLE)); registerFunction("asin", new StandardSQLFunction("asin", StandardBasicTypes.DOUBLE)); registerFunction("atan", new StandardSQLFunction("atan", StandardBasicTypes.DOUBLE)); registerFunction("cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE)); registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE)); registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE)); registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE)); registerFunction("stddev", new StandardSQLFunction("stddev", StandardBasicTypes.DOUBLE)); registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE)); registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE)); registerFunction("variance", new StandardSQLFunction("variance", StandardBasicTypes.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", StandardBasicTypes.CHARACTER)); registerFunction("initcap", new StandardSQLFunction("initcap")); registerFunction("lower", new StandardSQLFunction("lower")); registerFunction("ltrim", new StandardSQLFunction("ltrim")); registerFunction("rtrim", new StandardSQLFunction("rtrim")); registerFunction("upper", new StandardSQLFunction("upper")); registerFunction("ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER)); registerFunction("to_char", new StandardSQLFunction("to_char", StandardBasicTypes.STRING)); registerFunction("to_date", new StandardSQLFunction("to_date", StandardBasicTypes.TIMESTAMP)); registerFunction("current_date", new NoArgSQLFunction("current_date", StandardBasicTypes.DATE, false)); registerFunction("current_time", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIME, false)); registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", StandardBasicTypes.TIMESTAMP, false)); registerFunction("last_day", new StandardSQLFunction("last_day", StandardBasicTypes.DATE)); registerFunction("sysdate", new NoArgSQLFunction("sysdate", StandardBasicTypes.DATE, false)); registerFunction("user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false)); // Multi-param string dialect functions... registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "")); registerFunction("instr", new StandardSQLFunction("instr", StandardBasicTypes.INTEGER)); registerFunction("instrb", new StandardSQLFunction("instrb", StandardBasicTypes.INTEGER)); registerFunction("lpad", new StandardSQLFunction("lpad", StandardBasicTypes.STRING)); registerFunction("replace", new StandardSQLFunction("replace", StandardBasicTypes.STRING)); registerFunction("rpad", new StandardSQLFunction("rpad", StandardBasicTypes.STRING)); registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); registerFunction("substrb", new StandardSQLFunction("substrb", StandardBasicTypes.STRING)); registerFunction("translate", new StandardSQLFunction("translate", StandardBasicTypes.STRING)); registerFunction("substring", new StandardSQLFunction("substr", StandardBasicTypes.STRING)); registerFunction("bit_length", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "vsize(?1)*8")); registerFunction("coalesce", new NvlFunction()); // Multi-param numeric dialect functions... registerFunction("atan2", new StandardSQLFunction("atan2", StandardBasicTypes.FLOAT)); registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.INTEGER)); registerFunction("mod", new StandardSQLFunction("mod", StandardBasicTypes.INTEGER)); registerFunction("nvl", new StandardSQLFunction("nvl")); registerFunction("nvl2", new StandardSQLFunction("nvl2")); registerFunction("power", new StandardSQLFunction("power", StandardBasicTypes.FLOAT)); // Multi-param date dialect functions... registerFunction("add_months", new StandardSQLFunction("add_months", StandardBasicTypes.DATE)); registerFunction("months_between", new StandardSQLFunction("months_between", StandardBasicTypes.FLOAT)); registerFunction("next_day", new StandardSQLFunction("next_day", StandardBasicTypes.DATE)); }
From source file:org.jmangos.world.persistence.MySQLDialect.java
License:Open Source License
public MySQLDialect() { super(); registerFunction("bitwise_and", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "(?1 & ?2)")); }