Java Code Examples for org.hibernate.dialect.function.NoArgSQLFunction

The following examples show how to use org.hibernate.dialect.function.NoArgSQLFunction. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: lams   Source File: InterbaseDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a InterbaseDialect
 */
public InterbaseDialect() {
	super();
	registerColumnType( Types.BIT, "smallint" );
	registerColumnType( Types.BIGINT, "numeric(18,0)" );
	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 precision" );
	registerColumnType( Types.DATE, "date" );
	registerColumnType( Types.TIME, "time" );
	registerColumnType( Types.TIMESTAMP, "timestamp" );
	registerColumnType( Types.VARBINARY, "blob" );
	registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
	registerColumnType( Types.BLOB, "blob" );
	registerColumnType( Types.CLOB, "blob sub_type 1" );
	registerColumnType( Types.BOOLEAN, "smallint" );
	
	registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(","||",")" ) );
	registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );

	getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
 
Example 2
Source Project: lams   Source File: PostgresPlusDialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a PostgresPlusDialect
 */
public PostgresPlusDialect() {
	super();

	registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
	registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
	registerFunction( "soundex", new StandardSQLFunction( "soundex" ) );
	registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.DATE, false ) );
	registerFunction( "rowid", new NoArgSQLFunction( "rowid", StandardBasicTypes.LONG, false ) );
	registerFunction( "rownum", new NoArgSQLFunction( "rownum", StandardBasicTypes.LONG, false ) );
	registerFunction( "instr", new StandardSQLFunction( "instr", StandardBasicTypes.INTEGER ) );
	registerFunction( "lpad", new StandardSQLFunction( "lpad", StandardBasicTypes.STRING ) );
	registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
	registerFunction( "rpad", new StandardSQLFunction( "rpad", StandardBasicTypes.STRING ) );
	registerFunction( "translate", new StandardSQLFunction( "translate", StandardBasicTypes.STRING ) );
	registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
	registerFunction( "coalesce", new NvlFunction() );
	registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.FLOAT ) );
	registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER ) );
	registerFunction( "nvl", new StandardSQLFunction( "nvl" ) );
	registerFunction( "nvl2", new StandardSQLFunction( "nvl2" ) );
	registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.FLOAT ) );
	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 ) );
}
 
Example 3
Source Project: lams   Source File: SQLServer2005Dialect.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a SQLServer2005Dialect
 */
public SQLServer2005Dialect() {
	// HHH-3965 fix
	// As per http://www.sql-server-helper.com/faq/sql-server-2005-varchar-max-p01.aspx
	// use varchar(max) and varbinary(max) instead of TEXT and IMAGE types
	registerColumnType( Types.BLOB, "varbinary(MAX)" );
	registerColumnType( Types.VARBINARY, "varbinary(MAX)" );
	registerColumnType( Types.VARBINARY, MAX_LENGTH, "varbinary($l)" );
	registerColumnType( Types.LONGVARBINARY, "varbinary(MAX)" );

	registerColumnType( Types.CLOB, "varchar(MAX)" );
	registerColumnType( Types.LONGVARCHAR, "varchar(MAX)" );
	registerColumnType( Types.VARCHAR, "varchar(MAX)" );
	registerColumnType( Types.VARCHAR, MAX_LENGTH, "varchar($l)" );

	registerColumnType( Types.BIGINT, "bigint" );
	registerColumnType( Types.BIT, "bit" );
	
	// HHH-8435 fix
	registerColumnType( Types.NCLOB, "nvarchar(MAX)" );

	registerFunction( "row_number", new NoArgSQLFunction( "row_number", StandardBasicTypes.INTEGER, true ) );
}
 
Example 4
Source Project: lams   Source File: Ingres9Dialect.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Register functions current_time, current_timestamp, current_date
 */
protected void registerDateTimeFunctions() {
	registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME, false ) );
	registerFunction(
			"current_timestamp", new NoArgSQLFunction(
			"current_timestamp",
			StandardBasicTypes.TIMESTAMP,
			false
	)
	);
	registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );
}
 
Example 5
Source Project: lams   Source File: SQLServer2008Dialect.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a SQLServer2008Dialect
 */
public SQLServer2008Dialect() {
	registerColumnType( Types.DATE, "date" );
	registerColumnType( Types.TIME, "time" );
	registerColumnType( Types.TIMESTAMP, "datetime2" );
	registerColumnType( Types.NVARCHAR, NVARCHAR_MAX_LENGTH, "nvarchar($l)" );
	registerColumnType( Types.NVARCHAR, "nvarchar(MAX)" );

	registerFunction(
			"current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP, false )
	);
}
 
Example 6
Source Project: lams   Source File: InformixDialect.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates new <code>InformixDialect</code> instance. Sets up the JDBC /
 * Informix type mappings.
 */
public InformixDialect() {
	super();

	registerColumnType( Types.BIGINT, "int8" );
	registerColumnType( Types.BINARY, "byte" );
	// Informix doesn't have a bit type
	registerColumnType( Types.BIT, "smallint" );
	registerColumnType( Types.CHAR, "char($l)" );
	registerColumnType( Types.DATE, "date" );
	registerColumnType( Types.DECIMAL, "decimal" );
	registerColumnType( Types.DOUBLE, "float" );
	registerColumnType( Types.FLOAT, "smallfloat" );
	registerColumnType( Types.INTEGER, "integer" );
	// or BYTE
	registerColumnType( Types.LONGVARBINARY, "blob" );
	// or TEXT?
	registerColumnType( Types.LONGVARCHAR, "clob" );
	// or MONEY
	registerColumnType( Types.NUMERIC, "decimal" );
	registerColumnType( Types.REAL, "smallfloat" );
	registerColumnType( Types.SMALLINT, "smallint" );
	registerColumnType( Types.TIMESTAMP, "datetime year to fraction(5)" );
	registerColumnType( Types.TIME, "datetime hour to second" );
	registerColumnType( Types.TINYINT, "smallint" );
	registerColumnType( Types.VARBINARY, "byte" );
	registerColumnType( Types.VARCHAR, "varchar($l)" );
	registerColumnType( Types.VARCHAR, 255, "varchar($l)" );
	registerColumnType( Types.VARCHAR, 32739, "lvarchar($l)" );

	registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
	registerFunction( "substring", new SQLFunctionTemplate(StandardBasicTypes.STRING, "substring(?1 FROM ?2 FOR ?3)"));
	registerFunction( "substr", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substr(?1, ?2, ?3)"));
	registerFunction( "coalesce", new NvlFunction());
	registerFunction( "nvl", new NvlFunction());
	registerFunction( "current_timestamp", new NoArgSQLFunction( "current", StandardBasicTypes.TIMESTAMP, false ) );
	registerFunction( "current_date", new NoArgSQLFunction( "today", StandardBasicTypes.DATE, false ) );

	uniqueDelegate = new InformixUniqueDelegate( this );
}
 
Example 7
Source Project: lams   Source File: TimesTenDialect.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a TimesTenDialect
 */
public TimesTenDialect() {
	super();
	registerColumnType( Types.BIT, "TINYINT" );
	registerColumnType( Types.BIGINT, "BIGINT" );
	registerColumnType( Types.SMALLINT, "SMALLINT" );
	registerColumnType( Types.TINYINT, "TINYINT" );
	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, "VARBINARY($l)" );
	registerColumnType( Types.NUMERIC, "DECIMAL($p, $s)" );
	// TimesTen has no BLOB/CLOB support, but these types may be suitable 
	// for some applications. The length is limited to 4 million bytes.
	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", StandardBasicTypes.STRING ) );
	registerFunction( "mod", new StandardSQLFunction( "mod" ) );
	registerFunction( "to_char", new StandardSQLFunction( "to_char", StandardBasicTypes.STRING ) );
	registerFunction( "to_date", new StandardSQLFunction( "to_date", StandardBasicTypes.TIMESTAMP ) );
	registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.TIMESTAMP, false ) );
	registerFunction( "getdate", new NoArgSQLFunction( "getdate", StandardBasicTypes.TIMESTAMP, false ) );
	registerFunction( "nvl", new StandardSQLFunction( "nvl" ) );
}
 
Example 8
public TimesTenDialect() {
	super();
	registerColumnType( Types.BIT, "TINYINT" );
	registerColumnType( Types.BIGINT, "BIGINT" );
	registerColumnType( Types.SMALLINT, "SMALLINT" );
	registerColumnType( Types.TINYINT, "TINYINT" );
	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, "VARBINARY($l)" );
	registerColumnType( Types.NUMERIC, "DECIMAL($p, $s)" );
	// TimesTen has no BLOB/CLOB support, but these types may be suitable
	// for some applications. The length is limited to 4 million bytes.
       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") );

}
 
Example 9
Source Project: butterfly   Source File: SQLiteDialect.java    License: Apache License 2.0 4 votes vote down vote up
public SQLiteDialect() {
    registerColumnType(Types.BIT, "boolean");
    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($p, $s)");
    registerColumnType(Types.DECIMAL, "decimal");
    registerColumnType(Types.CHAR, "char");
    registerColumnType(Types.VARCHAR, "varchar($l)");
    registerColumnType(Types.LONGVARCHAR, "longvarchar");
    registerColumnType(Types.DATE, "date");
    registerColumnType(Types.TIME, "time");
    registerColumnType(Types.TIMESTAMP, "datetime");
    registerColumnType(Types.BINARY, "blob");
    registerColumnType(Types.VARBINARY, "blob");
    registerColumnType(Types.LONGVARBINARY, "blob");
    registerColumnType(Types.BLOB, "blob");
    registerColumnType(Types.CLOB, "clob");
    registerColumnType(Types.BOOLEAN, "boolean");

    //registerFunction( "abs", new StandardSQLFunction("abs") );
    registerFunction( "concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "") );
    //registerFunction( "length", new StandardSQLFunction("length", StandardBasicTypes.LONG) );
    //registerFunction( "lower", new StandardSQLFunction("lower") );
    registerFunction( "mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1 % ?2" ) );
    registerFunction( "quote", new StandardSQLFunction("quote", StandardBasicTypes.STRING) );
    registerFunction( "random", new NoArgSQLFunction("random", StandardBasicTypes.INTEGER) );
    registerFunction( "round", new StandardSQLFunction("round") );
    registerFunction( "substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING) );
    registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substr(?1, ?2, ?3)" ) );
    registerFunction( "trim", new AbstractAnsiTrimEmulationFunction() {
        protected SQLFunction resolveBothSpaceTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?1)");
        }

        protected SQLFunction resolveBothSpaceTrimFromFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?2)");
        }

        protected SQLFunction resolveLeadingSpaceTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "ltrim(?1)");
        }

        protected SQLFunction resolveTrailingSpaceTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "rtrim(?1)");
        }

        protected SQLFunction resolveBothTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?1, ?2)");
        }

        protected SQLFunction resolveLeadingTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "ltrim(?1, ?2)");
        }

        protected SQLFunction resolveTrailingTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "rtrim(?1, ?2)");
        }
    } );
    //registerFunction( "upper", new StandardSQLFunction("upper") );
}
 
Example 10
Source Project: lams   Source File: Oracle8iDialect.java    License: GNU General Public License v2.0 4 votes vote down vote up
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( "bitand", new StandardSQLFunction("bitand") );
	registerFunction( "cos", new StandardSQLFunction("cos", StandardBasicTypes.DOUBLE) );
	registerFunction( "cosh", new StandardSQLFunction("cosh", StandardBasicTypes.DOUBLE) );
	registerFunction( "exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
	registerFunction( "ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
	registerFunction( "sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
	registerFunction( "sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE) );
	registerFunction( "stddev", new StandardSQLFunction("stddev", StandardBasicTypes.DOUBLE) );
	registerFunction( "sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
	registerFunction( "tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
	registerFunction( "tanh", new StandardSQLFunction("tanh", 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( "soundex", new StandardSQLFunction("soundex") );
	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( "systimestamp", new NoArgSQLFunction("systimestamp", StandardBasicTypes.TIMESTAMP, false) );
	registerFunction( "uid", new NoArgSQLFunction("uid", StandardBasicTypes.INTEGER, false) );
	registerFunction( "user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false) );

	registerFunction( "rowid", new NoArgSQLFunction("rowid", StandardBasicTypes.LONG, false) );
	registerFunction( "rownum", new NoArgSQLFunction("rownum", StandardBasicTypes.LONG, 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( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "instr(?2,?1)" ) );
	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) );

	registerFunction( "str", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
}
 
Example 11
Source Project: lams   Source File: SAPDBDialect.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a SAPDBDialect
 */
public SAPDBDialect() {
	super();
	registerColumnType( Types.BIT, "boolean" );
	registerColumnType( Types.BIGINT, "fixed(19,0)" );
	registerColumnType( Types.SMALLINT, "smallint" );
	registerColumnType( Types.TINYINT, "fixed(3,0)" );
	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, "date" );
	registerColumnType( Types.TIME, "time" );
	registerColumnType( Types.TIMESTAMP, "timestamp" );
	registerColumnType( Types.VARBINARY, "long byte" );
	registerColumnType( Types.NUMERIC, "fixed($p,$s)" );
	registerColumnType( Types.CLOB, "long varchar" );
	registerColumnType( Types.BLOB, "long byte" );

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

	registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
	registerFunction( "ln", new StandardSQLFunction( "ln", StandardBasicTypes.DOUBLE ) );
	registerFunction( "log", new StandardSQLFunction( "ln", StandardBasicTypes.DOUBLE ) );
	registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) );
	registerFunction( "power", new StandardSQLFunction( "power" ) );
	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( "cosh", new StandardSQLFunction( "cosh", StandardBasicTypes.DOUBLE ) );
	registerFunction( "cot", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
	registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
	registerFunction( "sinh", new StandardSQLFunction( "sinh", StandardBasicTypes.DOUBLE ) );
	registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) );
	registerFunction( "tanh", new StandardSQLFunction( "tanh", StandardBasicTypes.DOUBLE ) );
	registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
	registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) );
	registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.DOUBLE ) );

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

	registerFunction( "time", new StandardSQLFunction( "time", StandardBasicTypes.TIME ) );
	registerFunction( "timestamp", new StandardSQLFunction( "timestamp", StandardBasicTypes.TIMESTAMP ) );
	registerFunction( "date", new StandardSQLFunction( "date", StandardBasicTypes.DATE ) );
	registerFunction( "microsecond", new StandardSQLFunction( "microsecond", StandardBasicTypes.INTEGER ) );

	registerFunction( "second", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "second(?1)" ) );
	registerFunction( "minute", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "minute(?1)" ) );
	registerFunction( "hour", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "hour(?1)" ) );
	registerFunction( "day", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "day(?1)" ) );
	registerFunction( "month", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "month(?1)" ) );
	registerFunction( "year", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "year(?1)" ) );

	registerFunction( "extract", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "?1(?3)" ) );

	registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) );
	registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) );
	registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
	registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
	registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
	registerFunction( "weekofyear", new StandardSQLFunction( "weekofyear", StandardBasicTypes.INTEGER ) );

	registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
	registerFunction( "translate", new StandardSQLFunction( "translate", StandardBasicTypes.STRING ) );
	registerFunction( "lpad", new StandardSQLFunction( "lpad", StandardBasicTypes.STRING ) );
	registerFunction( "rpad", new StandardSQLFunction( "rpad", StandardBasicTypes.STRING ) );
	registerFunction( "substr", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
	registerFunction( "initcap", new StandardSQLFunction( "initcap", StandardBasicTypes.STRING ) );
	registerFunction( "lower", new StandardSQLFunction( "lower", StandardBasicTypes.STRING ) );
	registerFunction( "ltrim", new StandardSQLFunction( "ltrim", StandardBasicTypes.STRING ) );
	registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) );
	registerFunction( "lfill", new StandardSQLFunction( "ltrim", StandardBasicTypes.STRING ) );
	registerFunction( "rfill", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) );
	registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
	registerFunction( "upper", new StandardSQLFunction( "upper", StandardBasicTypes.STRING ) );
	registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.STRING ) );
	registerFunction( "index", new StandardSQLFunction( "index", StandardBasicTypes.INTEGER ) );

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

	registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
	registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
	registerFunction( "locate", new StandardSQLFunction( "index", StandardBasicTypes.INTEGER ) );
	registerFunction( "coalesce", new StandardSQLFunction( "value" ) );

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

}
 
Example 12
public AbstractTransactSQLDialect() {
	super();
	registerColumnType( Types.BINARY, "binary($l)" );
	registerColumnType( Types.BIT, "tinyint" );
	registerColumnType( Types.BIGINT, "numeric(19,0)" );
	registerColumnType( Types.SMALLINT, "smallint" );
	registerColumnType( Types.TINYINT, "smallint" );
	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", StandardBasicTypes.INTEGER ) );
	registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) );
	registerFunction( "len", new StandardSQLFunction( "len", StandardBasicTypes.LONG ) );
	registerFunction( "lower", new StandardSQLFunction( "lower" ) );
	registerFunction( "upper", new StandardSQLFunction( "upper" ) );
	registerFunction( "str", new StandardSQLFunction( "str", StandardBasicTypes.STRING ) );
	registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
	registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
	registerFunction( "reverse", new StandardSQLFunction( "reverse" ) );
	registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );

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

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

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

	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( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) );
	registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) );
	registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
	registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE ) );
	registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) );
	registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) );
	registerFunction( "square", new StandardSQLFunction( "square" ) );
	registerFunction( "rand", new StandardSQLFunction( "rand", StandardBasicTypes.FLOAT ) );

	registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
	registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.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( StandardBasicTypes.STRING, "(", "+", ")" ) );

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

	getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
 
Example 13
Source Project: lams   Source File: PostgreSQL81Dialect.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a PostgreSQL81Dialect
 */
public PostgreSQL81Dialect() {
	super();
	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( "rand", 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", StandardBasicTypes.STRING) );
	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" );
}
 
Example 14
Source Project: gemfirexd-oss   Source File: GemFireXDDialect.java    License: Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
        LOG.info("GemFireXDDialect for Hibernate 4.0 initialized.");
              
	registerFunction("concat", new DerbyConcatFunction());
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("value", new StandardSQLFunction("coalesce"));
	registerFunction("nvl", new NvlFunction());
	registerFunction("groups", new StandardSQLFunction("GROUPS",
			StandardBasicTypes.STRING));
	registerFunction("dsid", new StandardSQLFunction("DSID",
			StandardBasicTypes.STRING));
	registerFunction("groupsintersection", new StandardSQLFunction(
			"GROUPSINTERSECTION", StandardBasicTypes.STRING));
	registerFunction("groupsintersect", new StandardSQLFunction(
			"GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
	registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
			StandardBasicTypes.STRING));
	registerFunction("longint", new StandardSQLFunction("bigint",
			StandardBasicTypes.LONG));
	registerFunction("int", new StandardSQLFunction("integer",
			StandardBasicTypes.INTEGER));
	registerFunction("pi", new StandardSQLFunction("pi",
			StandardBasicTypes.DOUBLE));
	registerFunction("random", new NoArgSQLFunction("random",
			StandardBasicTypes.DOUBLE));
	registerFunction("rand", new StandardSQLFunction("rand",
			StandardBasicTypes.DOUBLE));// override
	registerFunction("sinh", new StandardSQLFunction("sinh",
			StandardBasicTypes.DOUBLE));
	registerFunction("cosh", new StandardSQLFunction("cosh",
			StandardBasicTypes.DOUBLE));
	registerFunction("tanh", new StandardSQLFunction("tanh",
			StandardBasicTypes.DOUBLE));
	registerFunction("user", new NoArgSQLFunction("USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current isolation", new NoArgSQLFunction(
			"CURRENT ISOLATION", StandardBasicTypes.STRING, false));
	registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
			StandardBasicTypes.STRING, false));
	registerFunction("current schema", new NoArgSQLFunction(
			"CURRENT SCHEMA", StandardBasicTypes.STRING, false));
	registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
			StandardBasicTypes.STRING, false));
	registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
			StandardBasicTypes.NUMERIC_BOOLEAN));
	registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
			StandardBasicTypes.TEXT));
	registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
			StandardBasicTypes.STRING));
	registerFunction("xmlserialize", new StandardSQLFunction(
			"XMLSERIALIZE", StandardBasicTypes.STRING));
	registerFunction("get_current_connection", new NoArgSQLFunction(
			"GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
	registerFunction("identity_val_local", new NoArgSQLFunction(
			"IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example 15
Source Project: gemfirexd-oss   Source File: GemFireXDDialect.java    License: Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
        LOG.info("GemFireXDDialect for Hibernate 4 initialized.");
              
	registerFunction("concat", new DerbyConcatFunction());
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("value", new StandardSQLFunction("coalesce"));
	registerFunction("nvl", new NvlFunction());
	registerFunction("groups", new StandardSQLFunction("GROUPS",
			StandardBasicTypes.STRING));
	registerFunction("dsid", new StandardSQLFunction("DSID",
			StandardBasicTypes.STRING));
	registerFunction("groupsintersection", new StandardSQLFunction(
			"GROUPSINTERSECTION", StandardBasicTypes.STRING));
	registerFunction("groupsintersect", new StandardSQLFunction(
			"GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
	registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
			StandardBasicTypes.STRING));
	registerFunction("longint", new StandardSQLFunction("bigint",
			StandardBasicTypes.LONG));
	registerFunction("int", new StandardSQLFunction("integer",
			StandardBasicTypes.INTEGER));
	registerFunction("pi", new StandardSQLFunction("pi",
			StandardBasicTypes.DOUBLE));
	registerFunction("random", new NoArgSQLFunction("random",
			StandardBasicTypes.DOUBLE));
	registerFunction("rand", new StandardSQLFunction("rand",
			StandardBasicTypes.DOUBLE));// override
	registerFunction("sinh", new StandardSQLFunction("sinh",
			StandardBasicTypes.DOUBLE));
	registerFunction("cosh", new StandardSQLFunction("cosh",
			StandardBasicTypes.DOUBLE));
	registerFunction("tanh", new StandardSQLFunction("tanh",
			StandardBasicTypes.DOUBLE));
	registerFunction("user", new NoArgSQLFunction("USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current isolation", new NoArgSQLFunction(
			"CURRENT ISOLATION", StandardBasicTypes.STRING, false));
	registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
			StandardBasicTypes.STRING, false));
	registerFunction("current schema", new NoArgSQLFunction(
			"CURRENT SCHEMA", StandardBasicTypes.STRING, false));
	registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
			StandardBasicTypes.STRING, false));
	registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
			StandardBasicTypes.NUMERIC_BOOLEAN));
	registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
			StandardBasicTypes.TEXT));
	registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
			StandardBasicTypes.STRING));
	registerFunction("xmlserialize", new StandardSQLFunction(
			"XMLSERIALIZE", StandardBasicTypes.STRING));
	registerFunction("get_current_connection", new NoArgSQLFunction(
			"GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
	registerFunction("identity_val_local", new NoArgSQLFunction(
			"IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example 16
Source Project: gemfirexd-oss   Source File: GemFireXDDialect.java    License: Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
	LOG.info("GemFireXDDialect for Hibernate 3.6 initialized.");
	    
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("concat", new DerbyConcatFunction());
	
               registerFunction("value", new StandardSQLFunction("coalesce"));
               registerFunction("nvl", new NvlFunction());
               registerFunction("groups", new StandardSQLFunction("GROUPS",
                   StandardBasicTypes.STRING));
               registerFunction("dsid", new StandardSQLFunction("DSID",
                   StandardBasicTypes.STRING));
               registerFunction("groupsintersection", new StandardSQLFunction(
                   "GROUPSINTERSECTION", StandardBasicTypes.STRING));
               registerFunction("groupsintersect", new StandardSQLFunction(
                   "GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
               registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
                   StandardBasicTypes.STRING));
               registerFunction("longint", new StandardSQLFunction("bigint",
                   StandardBasicTypes.LONG));
               registerFunction("int", new StandardSQLFunction("integer",
                   StandardBasicTypes.INTEGER));
               registerFunction("pi", new StandardSQLFunction("pi",
                   StandardBasicTypes.DOUBLE));
               registerFunction("random", new NoArgSQLFunction("random",
                   StandardBasicTypes.DOUBLE));
               registerFunction("rand", new StandardSQLFunction("rand",
                   StandardBasicTypes.DOUBLE));// override
               registerFunction("sinh", new StandardSQLFunction("sinh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("cosh", new StandardSQLFunction("cosh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("tanh", new StandardSQLFunction("tanh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("user", new NoArgSQLFunction("USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("current isolation", new NoArgSQLFunction(
                   "CURRENT ISOLATION", StandardBasicTypes.STRING, false));
               registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
                   StandardBasicTypes.STRING, false));
               registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA",
                   StandardBasicTypes.STRING, false));
               registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
                   StandardBasicTypes.STRING, false));
               registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
                   StandardBasicTypes.NUMERIC_BOOLEAN));
               registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
                   StandardBasicTypes.TEXT));
               registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
                   StandardBasicTypes.STRING));
               registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE",
                   StandardBasicTypes.STRING));
               registerFunction("get_current_connection", new NoArgSQLFunction(
                   "GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
               registerFunction("identity_val_local", new NoArgSQLFunction(
                   "IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example 17
Source Project: gemfirexd-oss   Source File: GemFireXDDialect.java    License: Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
		super();
	        LOG.info("GemFireXDDialect for Hibernate 3 initialized.");
	              
/*		registerFunction("trim", new AnsiTrimFunction());
		registerFunction("concat", new DerbyConcatFunction());*/

                registerFunction("value", new StandardSQLFunction("coalesce"));
                registerFunction("nvl", new NvlFunction());
                registerFunction("groups", new StandardSQLFunction("GROUPS",
                    Hibernate.STRING));
                registerFunction("dsid", new StandardSQLFunction("DSID", Hibernate.STRING));
                registerFunction("groupsintersection", new StandardSQLFunction(
                    "GROUPSINTERSECTION", Hibernate.STRING));
                registerFunction("groupsintersect", new StandardSQLFunction(
                    "GROUPSINTERSECT", Hibernate.BOOLEAN));
                registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
                    Hibernate.STRING));
                registerFunction("longint", new StandardSQLFunction("bigint",
                    Hibernate.LONG));
                registerFunction("int", new StandardSQLFunction("integer",
                    Hibernate.INTEGER));
                registerFunction("pi", new StandardSQLFunction("pi", Hibernate.DOUBLE));
                registerFunction("random", new NoArgSQLFunction("random", Hibernate.DOUBLE));
                registerFunction("rand", new StandardSQLFunction("rand", Hibernate.DOUBLE));// override
                registerFunction("sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE));
                registerFunction("cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE));
                registerFunction("tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE));
                registerFunction("user", new NoArgSQLFunction("USER", Hibernate.STRING,
                    false));
                registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
                    Hibernate.STRING, false));
                registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
                    Hibernate.STRING, false));
                registerFunction("current isolation", new NoArgSQLFunction(
                    "CURRENT ISOLATION", Hibernate.STRING, false));
                registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
                    Hibernate.STRING, false));
                registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA",
                    Hibernate.STRING, false));
                registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
                    Hibernate.STRING, false));
                registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
                    Hibernate.BOOLEAN));
                registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
                    Hibernate.TEXT));
                registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
                    Hibernate.STRING));
                registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE",
                    Hibernate.STRING));
                registerFunction("get_current_connection", new NoArgSQLFunction(
                    "GET_CURRENT_CONNECTION", Hibernate.BINARY, true));
                registerFunction("identity_val_local", new NoArgSQLFunction(
                    "IDENTITY_VAL_LOCAL", Hibernate.BINARY, true));
	}
 
Example 18
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( "lastday", new StandardSQLFunction("lastday", 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) );
}
 
Example 19
public SAPDBDialect() {
	super();
	registerColumnType( Types.BIT, "boolean" );
	registerColumnType( Types.BIGINT, "fixed(19,0)" );
	registerColumnType( Types.SMALLINT, "smallint" );
	registerColumnType( Types.TINYINT, "fixed(3,0)" );
	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, "date" );
	registerColumnType( Types.TIME, "time" );
	registerColumnType( Types.TIMESTAMP, "timestamp" );
	registerColumnType( Types.VARBINARY, "long byte" );
	registerColumnType( Types.NUMERIC, "fixed($p,$s)" );
	registerColumnType( Types.CLOB, "long varchar" );
	registerColumnType( Types.BLOB, "long byte" );
	
	registerFunction( "abs", new StandardSQLFunction("abs") );
	registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );

	registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
	registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
	registerFunction( "log", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
	registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
	registerFunction( "power", new StandardSQLFunction("power") );
	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("cos", Hibernate.DOUBLE) );
	registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
	registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
	registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
	registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
	registerFunction( "radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
	registerFunction( "degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
	registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE) );

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

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

	registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
	registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
	registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
	registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
	registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
	registerFunction("weekofyear", new StandardSQLFunction("weekofyear", Hibernate.INTEGER) );

	registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
	registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );
	registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
	registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
	registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
	registerFunction( "initcap", new StandardSQLFunction("initcap", Hibernate.STRING) );
	registerFunction( "lower", new StandardSQLFunction("lower", Hibernate.STRING) );
	registerFunction( "ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING) );
	registerFunction( "rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING) );
	registerFunction( "lfill", new StandardSQLFunction("ltrim", Hibernate.STRING) );
	registerFunction( "rfill", new StandardSQLFunction("rtrim", Hibernate.STRING) );
	registerFunction( "soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
	registerFunction( "upper", new StandardSQLFunction("upper", Hibernate.STRING) );
	registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.STRING) );
	registerFunction( "index", new StandardSQLFunction("index", Hibernate.INTEGER) );

	registerFunction( "value", new StandardSQLFunction( "value" ) );
	
	registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
	registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
	registerFunction( "locate", new StandardSQLFunction("index", Hibernate.INTEGER) );
	registerFunction( "coalesce", new StandardSQLFunction( "value" ) );

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

}
 
Example 20
public IngresDialect() {
	super();
	registerColumnType( Types.BIT, "tinyint" );
	registerColumnType( Types.TINYINT, "tinyint" );
	registerColumnType( Types.SMALLINT, "smallint" );
	registerColumnType( Types.INTEGER, "integer" );
	registerColumnType( Types.BIGINT, "bigint" );
	registerColumnType( Types.REAL, "real" );
	registerColumnType( Types.FLOAT, "float" );
	registerColumnType( Types.DOUBLE, "float" );
	registerColumnType( Types.NUMERIC, "decimal($p, $s)" );
	registerColumnType( Types.DECIMAL, "decimal($p, $s)" );
	registerColumnType( Types.BINARY, 32000, "byte($l)" );
	registerColumnType( Types.BINARY, "long byte" );
	registerColumnType( Types.VARBINARY, 32000, "varbyte($l)" );
	registerColumnType( Types.VARBINARY, "long byte" );
	registerColumnType( Types.LONGVARBINARY, "long byte" );
	registerColumnType( Types.CHAR, "char(1)" );
	registerColumnType( Types.VARCHAR, 32000, "varchar($l)" );
	registerColumnType( Types.VARCHAR, "long varchar" );
	registerColumnType( Types.LONGVARCHAR, "long varchar" );
	registerColumnType( Types.DATE, "date" );
	registerColumnType( Types.TIME, "time with time zone" );
	registerColumnType( Types.TIMESTAMP, "timestamp with time zone" );
	registerColumnType( Types.BLOB, "blob" );
	registerColumnType( Types.CLOB, "clob" );

	registerFunction( "abs", new StandardSQLFunction( "abs" ) );
	registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
	registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
	registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
	registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "octet_length(hex(?1))*4" ) );
	registerFunction( "bit_not", new StandardSQLFunction( "bit_not" ) );
	registerFunction( "bit_or", new StandardSQLFunction( "bit_or" ) );
	registerFunction( "bit_xor", new StandardSQLFunction( "bit_xor" ) );
	registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.LONG ) );
	registerFunction( "charextract", new StandardSQLFunction( "charextract", Hibernate.STRING ) );
	registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "+", ")" ) );
	registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
	registerFunction( "current_user", new NoArgSQLFunction( "current_user", Hibernate.STRING, false ) );
	registerFunction( "current_time", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
	registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
	registerFunction( "current_date", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
	registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
	registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
	registerFunction( "dba", new NoArgSQLFunction( "dba", Hibernate.STRING, true ) );
	registerFunction( "dow", new StandardSQLFunction( "dow", Hibernate.STRING ) );
	registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "date_part('?1', ?3)" ) );
	registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
	registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
	registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
	registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
	registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
	registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", Hibernate.STRING, false ) );
	registerFunction( "intextract", new StandardSQLFunction( "intextract", Hibernate.INTEGER ) );
	registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
	registerFunction( "locate", new SQLFunctionTemplate( Hibernate.LONG, "locate(?1, ?2)" ) );
	registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
	registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
	registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
	registerFunction( "lower", new StandardSQLFunction( "lower" ) );
	registerFunction( "lowercase", new StandardSQLFunction( "lowercase" ) );
	registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
	registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
	registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
	registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
	registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
	registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
	registerFunction( "random", new NoArgSQLFunction( "random", Hibernate.LONG, true ) );
	registerFunction( "randomf", new NoArgSQLFunction( "randomf", Hibernate.DOUBLE, true ) );
	registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
	registerFunction( "session_user", new NoArgSQLFunction( "session_user", Hibernate.STRING, false ) );
	registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
	registerFunction( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
	registerFunction( "squeeze", new StandardSQLFunction( "squeeze" ) );
	registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
	registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
	registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
	registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
	registerFunction( "system_user", new NoArgSQLFunction( "system_user", Hibernate.STRING, false ) );
	//registerFunction( "trim", new StandardSQLFunction( "trim", Hibernate.STRING ) );
	registerFunction( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
	registerFunction( "upper", new StandardSQLFunction( "upper" ) );
	registerFunction( "uppercase", new StandardSQLFunction( "uppercase" ) );
	registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING, false ) );
	registerFunction( "usercode", new NoArgSQLFunction( "usercode", Hibernate.STRING, true ) );
	registerFunction( "username", new NoArgSQLFunction( "username", Hibernate.STRING, true ) );
	registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", Hibernate.BYTE ) );
	registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", Hibernate.INTEGER ) );
	registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", Hibernate.BYTE ) );
	registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", Hibernate.STRING ) );
	registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
}
 
Example 21
public SybaseDialect() {
	super();
	registerColumnType( Types.BIT, "tinyint" ); //Sybase BIT type does not support null values
	registerColumnType( Types.BIGINT, "numeric(19,0)" );
	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);
}
 
Example 22
public PostgreSQLDialect() {
	super();
	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.CLOB, "text" );
	registerColumnType( Types.BLOB, "oid" );
	registerColumnType( Types.NUMERIC, "numeric($p, $s)" );

	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( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
	registerFunction( "log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
	registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
	registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
	registerFunction( "cbrt", new StandardSQLFunction("cbrt", Hibernate.DOUBLE) );
	registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
	registerFunction( "radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
	registerFunction( "degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );

	registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
	registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );

	registerFunction( "random", new NoArgSQLFunction("random", 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( "lower", new StandardSQLFunction("lower") );
	registerFunction( "upper", new StandardSQLFunction("upper") );
	registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
	registerFunction( "initcap", new StandardSQLFunction("initcap") );
	registerFunction( "to_ascii", new StandardSQLFunction("to_ascii") );
	registerFunction( "quote_ident", new StandardSQLFunction("quote_ident", Hibernate.STRING) );
	registerFunction( "quote_literal", new StandardSQLFunction("quote_literal", Hibernate.STRING) );
	registerFunction( "md5", new StandardSQLFunction("md5") );
	registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
	registerFunction( "length", new StandardSQLFunction("length", Hibernate.LONG) );
	registerFunction( "char_length", new StandardSQLFunction("char_length", Hibernate.LONG) );
	registerFunction( "bit_length", new StandardSQLFunction("bit_length", Hibernate.LONG) );
	registerFunction( "octet_length", new StandardSQLFunction("octet_length", Hibernate.LONG) );

	registerFunction( "current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
	registerFunction( "current_time", new NoArgSQLFunction("current_time", Hibernate.TIME, false) );
	registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
	registerFunction( "localtime", new NoArgSQLFunction("localtime", Hibernate.TIME, false) );
	registerFunction( "localtimestamp", new NoArgSQLFunction("localtimestamp", Hibernate.TIMESTAMP, false) );
	registerFunction( "now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP) );
	registerFunction( "timeofday", new NoArgSQLFunction("timeofday", Hibernate.STRING) );
	registerFunction( "age", new StandardSQLFunction("age") );

	registerFunction( "current_user", new NoArgSQLFunction("current_user", Hibernate.STRING, false) );
	registerFunction( "session_user", new NoArgSQLFunction("session_user", Hibernate.STRING, false) );
	registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );
	registerFunction( "current_database", new NoArgSQLFunction("current_database", Hibernate.STRING, true) );
	registerFunction( "current_schema", new NoArgSQLFunction("current_schema", Hibernate.STRING, true) );
	
	registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
	registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.DATE) );
	registerFunction( "to_timestamp", new StandardSQLFunction("to_timestamp", Hibernate.TIMESTAMP) );
	registerFunction( "to_number", new StandardSQLFunction("to_number", Hibernate.BIG_DECIMAL) );

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

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

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

	getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
}
 
Example 23
Source Project: gemfirexd-oss   Source File: GemFireXDDialect.java    License: Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
        LOG.info("GemFireXDDialect for Hibernate 4.0 initialized.");
              
	registerFunction("concat", new DerbyConcatFunction());
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("value", new StandardSQLFunction("coalesce"));
	registerFunction("nvl", new NvlFunction());
	registerFunction("groups", new StandardSQLFunction("GROUPS",
			StandardBasicTypes.STRING));
	registerFunction("dsid", new StandardSQLFunction("DSID",
			StandardBasicTypes.STRING));
	registerFunction("groupsintersection", new StandardSQLFunction(
			"GROUPSINTERSECTION", StandardBasicTypes.STRING));
	registerFunction("groupsintersect", new StandardSQLFunction(
			"GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
	registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
			StandardBasicTypes.STRING));
	registerFunction("longint", new StandardSQLFunction("bigint",
			StandardBasicTypes.LONG));
	registerFunction("int", new StandardSQLFunction("integer",
			StandardBasicTypes.INTEGER));
	registerFunction("pi", new StandardSQLFunction("pi",
			StandardBasicTypes.DOUBLE));
	registerFunction("random", new NoArgSQLFunction("random",
			StandardBasicTypes.DOUBLE));
	registerFunction("rand", new StandardSQLFunction("rand",
			StandardBasicTypes.DOUBLE));// override
	registerFunction("sinh", new StandardSQLFunction("sinh",
			StandardBasicTypes.DOUBLE));
	registerFunction("cosh", new StandardSQLFunction("cosh",
			StandardBasicTypes.DOUBLE));
	registerFunction("tanh", new StandardSQLFunction("tanh",
			StandardBasicTypes.DOUBLE));
	registerFunction("user", new NoArgSQLFunction("USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current isolation", new NoArgSQLFunction(
			"CURRENT ISOLATION", StandardBasicTypes.STRING, false));
	registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
			StandardBasicTypes.STRING, false));
	registerFunction("current schema", new NoArgSQLFunction(
			"CURRENT SCHEMA", StandardBasicTypes.STRING, false));
	registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
			StandardBasicTypes.STRING, false));
	registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
			StandardBasicTypes.NUMERIC_BOOLEAN));
	registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
			StandardBasicTypes.TEXT));
	registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
			StandardBasicTypes.STRING));
	registerFunction("xmlserialize", new StandardSQLFunction(
			"XMLSERIALIZE", StandardBasicTypes.STRING));
	registerFunction("get_current_connection", new NoArgSQLFunction(
			"GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
	registerFunction("identity_val_local", new NoArgSQLFunction(
			"IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example 24
Source Project: gemfirexd-oss   Source File: GemFireXDDialect.java    License: Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
        LOG.info("GemFireXDDialect for Hibernate 4 initialized.");
              
	registerFunction("concat", new DerbyConcatFunction());
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("value", new StandardSQLFunction("coalesce"));
	registerFunction("nvl", new NvlFunction());
	registerFunction("groups", new StandardSQLFunction("GROUPS",
			StandardBasicTypes.STRING));
	registerFunction("dsid", new StandardSQLFunction("DSID",
			StandardBasicTypes.STRING));
	registerFunction("groupsintersection", new StandardSQLFunction(
			"GROUPSINTERSECTION", StandardBasicTypes.STRING));
	registerFunction("groupsintersect", new StandardSQLFunction(
			"GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
	registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
			StandardBasicTypes.STRING));
	registerFunction("longint", new StandardSQLFunction("bigint",
			StandardBasicTypes.LONG));
	registerFunction("int", new StandardSQLFunction("integer",
			StandardBasicTypes.INTEGER));
	registerFunction("pi", new StandardSQLFunction("pi",
			StandardBasicTypes.DOUBLE));
	registerFunction("random", new NoArgSQLFunction("random",
			StandardBasicTypes.DOUBLE));
	registerFunction("rand", new StandardSQLFunction("rand",
			StandardBasicTypes.DOUBLE));// override
	registerFunction("sinh", new StandardSQLFunction("sinh",
			StandardBasicTypes.DOUBLE));
	registerFunction("cosh", new StandardSQLFunction("cosh",
			StandardBasicTypes.DOUBLE));
	registerFunction("tanh", new StandardSQLFunction("tanh",
			StandardBasicTypes.DOUBLE));
	registerFunction("user", new NoArgSQLFunction("USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
			StandardBasicTypes.STRING, false));
	registerFunction("current isolation", new NoArgSQLFunction(
			"CURRENT ISOLATION", StandardBasicTypes.STRING, false));
	registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
			StandardBasicTypes.STRING, false));
	registerFunction("current schema", new NoArgSQLFunction(
			"CURRENT SCHEMA", StandardBasicTypes.STRING, false));
	registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
			StandardBasicTypes.STRING, false));
	registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
			StandardBasicTypes.NUMERIC_BOOLEAN));
	registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
			StandardBasicTypes.TEXT));
	registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
			StandardBasicTypes.STRING));
	registerFunction("xmlserialize", new StandardSQLFunction(
			"XMLSERIALIZE", StandardBasicTypes.STRING));
	registerFunction("get_current_connection", new NoArgSQLFunction(
			"GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
	registerFunction("identity_val_local", new NoArgSQLFunction(
			"IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example 25
Source Project: gemfirexd-oss   Source File: GemFireXDDialect.java    License: Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
	super();
	LOG.info("GemFireXDDialect for Hibernate 3.6 initialized.");
	    
	registerFunction("trim", new AnsiTrimFunction());
	registerFunction("concat", new DerbyConcatFunction());
	
               registerFunction("value", new StandardSQLFunction("coalesce"));
               registerFunction("nvl", new NvlFunction());
               registerFunction("groups", new StandardSQLFunction("GROUPS",
                   StandardBasicTypes.STRING));
               registerFunction("dsid", new StandardSQLFunction("DSID",
                   StandardBasicTypes.STRING));
               registerFunction("groupsintersection", new StandardSQLFunction(
                   "GROUPSINTERSECTION", StandardBasicTypes.STRING));
               registerFunction("groupsintersect", new StandardSQLFunction(
                   "GROUPSINTERSECT", StandardBasicTypes.BOOLEAN));
               registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
                   StandardBasicTypes.STRING));
               registerFunction("longint", new StandardSQLFunction("bigint",
                   StandardBasicTypes.LONG));
               registerFunction("int", new StandardSQLFunction("integer",
                   StandardBasicTypes.INTEGER));
               registerFunction("pi", new StandardSQLFunction("pi",
                   StandardBasicTypes.DOUBLE));
               registerFunction("random", new NoArgSQLFunction("random",
                   StandardBasicTypes.DOUBLE));
               registerFunction("rand", new StandardSQLFunction("rand",
                   StandardBasicTypes.DOUBLE));// override
               registerFunction("sinh", new StandardSQLFunction("sinh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("cosh", new StandardSQLFunction("cosh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("tanh", new StandardSQLFunction("tanh",
                   StandardBasicTypes.DOUBLE));
               registerFunction("user", new NoArgSQLFunction("USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
                   StandardBasicTypes.STRING, false));
               registerFunction("current isolation", new NoArgSQLFunction(
                   "CURRENT ISOLATION", StandardBasicTypes.STRING, false));
               registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
                   StandardBasicTypes.STRING, false));
               registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA",
                   StandardBasicTypes.STRING, false));
               registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
                   StandardBasicTypes.STRING, false));
               registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
                   StandardBasicTypes.NUMERIC_BOOLEAN));
               registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
                   StandardBasicTypes.TEXT));
               registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
                   StandardBasicTypes.STRING));
               registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE",
                   StandardBasicTypes.STRING));
               registerFunction("get_current_connection", new NoArgSQLFunction(
                   "GET_CURRENT_CONNECTION", StandardBasicTypes.BINARY, true));
               registerFunction("identity_val_local", new NoArgSQLFunction(
                   "IDENTITY_VAL_LOCAL", StandardBasicTypes.BINARY, true));
}
 
Example 26
Source Project: gemfirexd-oss   Source File: GemFireXDDialect.java    License: Apache License 2.0 4 votes vote down vote up
public GemFireXDDialect() {
		super();
	        LOG.info("GemFireXDDialect for Hibernate 3 initialized.");
	              
/*		registerFunction("trim", new AnsiTrimFunction());
		registerFunction("concat", new DerbyConcatFunction());*/

                registerFunction("value", new StandardSQLFunction("coalesce"));
                registerFunction("nvl", new NvlFunction());
                registerFunction("groups", new StandardSQLFunction("GROUPS",
                    Hibernate.STRING));
                registerFunction("dsid", new StandardSQLFunction("DSID", Hibernate.STRING));
                registerFunction("groupsintersection", new StandardSQLFunction(
                    "GROUPSINTERSECTION", Hibernate.STRING));
                registerFunction("groupsintersect", new StandardSQLFunction(
                    "GROUPSINTERSECT", Hibernate.BOOLEAN));
                registerFunction("groupsunion", new StandardSQLFunction("GROUPSUNION",
                    Hibernate.STRING));
                registerFunction("longint", new StandardSQLFunction("bigint",
                    Hibernate.LONG));
                registerFunction("int", new StandardSQLFunction("integer",
                    Hibernate.INTEGER));
                registerFunction("pi", new StandardSQLFunction("pi", Hibernate.DOUBLE));
                registerFunction("random", new NoArgSQLFunction("random", Hibernate.DOUBLE));
                registerFunction("rand", new StandardSQLFunction("rand", Hibernate.DOUBLE));// override
                registerFunction("sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE));
                registerFunction("cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE));
                registerFunction("tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE));
                registerFunction("user", new NoArgSQLFunction("USER", Hibernate.STRING,
                    false));
                registerFunction("current_user", new NoArgSQLFunction("CURRENT_USER",
                    Hibernate.STRING, false));
                registerFunction("session_user", new NoArgSQLFunction("SESSION_USER",
                    Hibernate.STRING, false));
                registerFunction("current isolation", new NoArgSQLFunction(
                    "CURRENT ISOLATION", Hibernate.STRING, false));
                registerFunction("current_role", new NoArgSQLFunction("CURRENT_ROLE",
                    Hibernate.STRING, false));
                registerFunction("current schema", new NoArgSQLFunction("CURRENT SCHEMA",
                    Hibernate.STRING, false));
                registerFunction("current sqlid", new NoArgSQLFunction("CURRENT SQLID",
                    Hibernate.STRING, false));
                registerFunction("xmlexists", new StandardSQLFunction("XMLEXISTS",
                    Hibernate.BOOLEAN));
                registerFunction("xmlparse", new StandardSQLFunction("XMLPARSE",
                    Hibernate.TEXT));
                registerFunction("xmlquery", new StandardSQLFunction("XMLQUERY",
                    Hibernate.STRING));
                registerFunction("xmlserialize", new StandardSQLFunction("XMLSERIALIZE",
                    Hibernate.STRING));
                registerFunction("get_current_connection", new NoArgSQLFunction(
                    "GET_CURRENT_CONNECTION", Hibernate.BINARY, true));
                registerFunction("identity_val_local", new NoArgSQLFunction(
                    "IDENTITY_VAL_LOCAL", Hibernate.BINARY, true));
	}
 
Example 27
Source Project: yeti   Source File: SQLiteDialect.java    License: MIT License 4 votes vote down vote up
public SQLiteDialect() {
    registerColumnType(Types.BIT, "boolean");
    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($p, $s)");
    registerColumnType(Types.DECIMAL, "decimal");
    registerColumnType(Types.CHAR, "char");
    registerColumnType(Types.VARCHAR, "varchar($l)");
    registerColumnType(Types.LONGVARCHAR, "longvarchar");
    registerColumnType(Types.DATE, "date");
    registerColumnType(Types.TIME, "time");
    registerColumnType(Types.TIMESTAMP, "datetime");
    registerColumnType(Types.BINARY, "blob");
    registerColumnType(Types.VARBINARY, "blob");
    registerColumnType(Types.LONGVARBINARY, "blob");
    registerColumnType(Types.BLOB, "blob");
    registerColumnType(Types.CLOB, "clob");
    registerColumnType(Types.BOOLEAN, "boolean");

    registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", ""));
    registerFunction("mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1 % ?2"));
    registerFunction("quote", new StandardSQLFunction("quote", StandardBasicTypes.STRING));
    registerFunction("random", new NoArgSQLFunction("random", StandardBasicTypes.INTEGER));
    registerFunction("round", new StandardSQLFunction("round"));
    registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING));
    registerFunction("trim", new AbstractAnsiTrimEmulationFunction() {
        @Override
        protected SQLFunction resolveBothSpaceTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?1)");
        }

        @Override
        protected SQLFunction resolveBothSpaceTrimFromFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?2)");
        }

        @Override
        protected SQLFunction resolveLeadingSpaceTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "ltrim(?1)");
        }

        @Override
        protected SQLFunction resolveTrailingSpaceTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "rtrim(?1)");
        }

        @Override
        protected SQLFunction resolveBothTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?1, ?2)");
        }

        @Override
        protected SQLFunction resolveLeadingTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "ltrim(?1, ?2)");
        }

        @Override
        protected SQLFunction resolveTrailingTrimFunction() {
            return new SQLFunctionTemplate(StandardBasicTypes.STRING, "rtrim(?1, ?2)");
        }
    });
}