本文整理汇总了Java中org.hibernate.dialect.function.NoArgSQLFunction类的典型用法代码示例。如果您正苦于以下问题:Java NoArgSQLFunction类的具体用法?Java NoArgSQLFunction怎么用?Java NoArgSQLFunction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoArgSQLFunction类属于org.hibernate.dialect.function包,在下文中一共展示了NoArgSQLFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InterbaseDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
/**
* 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 );
}
示例2: PostgresPlusDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
/**
* 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 ) );
}
示例3: SQLServer2005Dialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
/**
* 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" );
registerFunction( "row_number", new NoArgSQLFunction( "row_number", StandardBasicTypes.INTEGER, true ) );
}
示例4: registerDateTimeFunctions
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
/**
* 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 ) );
}
示例5: SQLServer2008Dialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
/**
* Constructs a SQLServer2008Dialect
*/
public SQLServer2008Dialect() {
registerColumnType( Types.DATE, "date" );
registerColumnType( Types.TIME, "time" );
registerColumnType( Types.TIMESTAMP, "datetime2" );
registerFunction(
"current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP, false )
);
}
示例6: TimesTenDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
/**
* 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" ) );
}
示例7: TimesTenDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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") );
}
示例8: SQLiteDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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) );}
示例9: SQLiteDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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() {
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)");
}
});
}
示例10: registerFunctions
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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) );
}
示例11: AbstractTransactSQLDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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 );
}
示例12: SQLiteDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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") );
}
示例13: SQLiteDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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() {
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)");
}
} );
uniqueDelegate = new SQLiteUniqueDelegate( this );
}
示例14: SQLiteDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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)");
}
});
uniqueDelegate = new SQLiteUniqueDelegate(this);
}
示例15: GemFireXDDialect
import org.hibernate.dialect.function.NoArgSQLFunction; //导入依赖的package包/类
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));
}