org.hibernate.dialect.function.SQLFunctionTemplate#org.hibernate.dialect.function.StandardSQLFunction源码实例Demo

下面列出了org.hibernate.dialect.function.SQLFunctionTemplate#org.hibernate.dialect.function.StandardSQLFunction 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: SQLServerDialect.java
/**
 * Constructs a SQLServerDialect
 */
public SQLServerDialect() {
	registerColumnType( Types.VARBINARY, "image" );
	registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
	registerColumnType( Types.LONGVARBINARY, "image" );
	registerColumnType( Types.LONGVARCHAR, "text" );
	registerColumnType( Types.BOOLEAN, "bit" );

	registerFunction( "second", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(second, ?1)" ) );
	registerFunction( "minute", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(minute, ?1)" ) );
	registerFunction( "hour", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(hour, ?1)" ) );
	registerFunction( "locate", new StandardSQLFunction( "charindex", StandardBasicTypes.INTEGER ) );

	registerFunction( "extract", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datepart(?1, ?3)" ) );
	registerFunction( "mod", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "?1 % ?2" ) );
	registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "datalength(?1) * 8" ) );

	registerFunction( "trim", new AnsiTrimEmulationFunction() );

	registerKeyword( "top" );
	registerKeyword( "key" );

	this.limitHandler = new TopLimitHandler( false, false );
}
 
源代码2 项目: lams   文件: PostgresPlusDialect.java
/**
 * 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 项目: cacheonix-core   文件: SQLServerDialect.java
public SQLServerDialect() {
	registerColumnType( Types.VARBINARY, "image" );
	registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );

	registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(second, ?1)") );
	registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(minute, ?1)") );
	registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(hour, ?1)") );
	registerFunction( "locate", new StandardSQLFunction("charindex", Hibernate.INTEGER) );

	registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
	registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
	registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "datalength(?1) * 8" ) );

	registerFunction( "trim", new AnsiTrimEmulationFunction() );

	registerKeyword("top");
}
 
源代码4 项目: oim-fx   文件: SQLiteDialect.java
public SQLiteDialect() {
	super();
	registerColumnType(Types.BIT, "integer");
	registerColumnType(Types.TINYINT, "tinyint");
	registerColumnType(Types.SMALLINT, "smallint");
	registerColumnType(Types.INTEGER, "integer");
	registerColumnType(Types.BIGINT, "bigint");
	registerColumnType(Types.FLOAT, "float");
	registerColumnType(Types.REAL, "real");
	registerColumnType(Types.DOUBLE, "double");
	registerColumnType(Types.NUMERIC, "numeric");
	registerColumnType(Types.DECIMAL, "decimal");
	registerColumnType(Types.CHAR, "char");
	registerColumnType(Types.VARCHAR, "varchar");
	registerColumnType(Types.LONGVARCHAR, "longvarchar");
	registerColumnType(Types.DATE, "date");
	registerColumnType(Types.TIME, "time");
	registerColumnType(Types.TIMESTAMP, "timestamp");
	registerColumnType(Types.BINARY, "blob");
	registerColumnType(Types.VARBINARY, "blob");
	registerColumnType(Types.LONGVARBINARY, "blob");
	// registerColumnType(Types.NULL, "null");
	registerColumnType(Types.BLOB, "blob");
	registerColumnType(Types.CLOB, "clob");
	registerColumnType(Types.BOOLEAN, "integer");

	registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", ""));
	registerFunction("mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1 % ?2"));
	registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING));
	registerFunction("substring", new StandardSQLFunction("substr", StandardBasicTypes.STRING));
}
 
public SQLiteDialect() {
    registerColumnType(Types.BIT, "integer");
    registerColumnType(Types.TINYINT, "tinyint");
    registerColumnType(Types.SMALLINT, "smallint");
    registerColumnType(Types.INTEGER, "integer");
    registerColumnType(Types.BIGINT, "bigint");
    registerColumnType(Types.FLOAT, "float");
    registerColumnType(Types.REAL, "real");
    registerColumnType(Types.DOUBLE, "double");
    registerColumnType(Types.NUMERIC, "numeric");
    registerColumnType(Types.DECIMAL, "decimal");
    registerColumnType(Types.CHAR, "char");
    registerColumnType(Types.VARCHAR, "varchar");
    registerColumnType(Types.LONGVARCHAR, "longvarchar");
    registerColumnType(Types.DATE, "date");
    registerColumnType(Types.TIME, "time");
    registerColumnType(Types.TIMESTAMP, "timestamp");
    registerColumnType(Types.BINARY, "blob");
    registerColumnType(Types.VARBINARY, "blob");
    registerColumnType(Types.LONGVARBINARY, "blob");
    // registerColumnType(Types.NULL, "null");
    registerColumnType(Types.BLOB, "blob");
    registerColumnType(Types.CLOB, "clob");
    registerColumnType(Types.BOOLEAN, "integer");

    registerFunction("concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", ""));
    registerFunction("mod", new SQLFunctionTemplate(StringType.INSTANCE, "?1 % ?2"));
    registerFunction("substr", new StandardSQLFunction("substr", StringType.INSTANCE));
    registerFunction("substring", new StandardSQLFunction("substr", StringType.INSTANCE));
}
 
源代码6 项目: lams   文件: TimesTenDialect.java
/**
 * 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 项目: lams   文件: MariaDB10Dialect.java
public MariaDB10Dialect() {
	super();

	registerFunction( "regexp_replace", new StandardSQLFunction( "regexp_replace", StandardBasicTypes.STRING ) );
	registerFunction( "regexp_instr", new StandardSQLFunction( "regexp_instr", StandardBasicTypes.INTEGER ) );
	registerFunction( "regexp_substr", new StandardSQLFunction( "regexp_substr", StandardBasicTypes.STRING ) );
	registerFunction( "weight_string", new StandardSQLFunction( "weight_string", StandardBasicTypes.STRING ) );
	registerFunction( "to_base64", new StandardSQLFunction( "to_base64", StandardBasicTypes.STRING ) );
	registerFunction( "from_base64", new StandardSQLFunction( "from_base64", StandardBasicTypes.STRING ) );
}
 
源代码8 项目: lams   文件: MckoiDialect.java
/**
 * Constructs a MckoiDialect
 */
public MckoiDialect() {
	super();
	registerColumnType( Types.BIT, "bit" );
	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" );
	registerColumnType( Types.NUMERIC, "numeric" );
	registerColumnType( Types.BLOB, "blob" );
	registerColumnType( Types.CLOB, "clob" );

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

	getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
}
 
源代码9 项目: lams   文件: PostgreSQL94Dialect.java
/**
 * Constructs a PostgreSQL94Dialect
 */
public PostgreSQL94Dialect() {
	super();
	registerFunction( "make_interval", new StandardSQLFunction("make_interval", StandardBasicTypes.TIMESTAMP) );
	registerFunction( "make_timestamp", new StandardSQLFunction("make_timestamp", StandardBasicTypes.TIMESTAMP) );
	registerFunction( "make_timestamptz", new StandardSQLFunction("make_timestamptz", StandardBasicTypes.TIMESTAMP) );
	registerFunction( "make_date", new StandardSQLFunction("make_date", StandardBasicTypes.DATE) );
	registerFunction( "make_time", new StandardSQLFunction("make_time", StandardBasicTypes.TIME) );
}
 
源代码10 项目: MonitorClient   文件: SQLiteDialect.java
public SQLiteDialect() {
    registerColumnType(Types.BIT, "integer");
    registerColumnType(Types.TINYINT, "tinyint");
    registerColumnType(Types.SMALLINT, "smallint");
    registerColumnType(Types.INTEGER, "integer");
    registerColumnType(Types.BIGINT, "bigint");
    registerColumnType(Types.FLOAT, "float");
    registerColumnType(Types.REAL, "real");
    registerColumnType(Types.DOUBLE, "double");
    registerColumnType(Types.NUMERIC, "numeric");
    registerColumnType(Types.DECIMAL, "decimal");
    registerColumnType(Types.CHAR, "char");
    registerColumnType(Types.VARCHAR, "varchar");
    registerColumnType(Types.LONGVARCHAR, "longvarchar");
    registerColumnType(Types.DATE, "date");
    registerColumnType(Types.TIME, "time");
    registerColumnType(Types.TIMESTAMP, "timestamp");
    registerColumnType(Types.BINARY, "blob");
    registerColumnType(Types.VARBINARY, "blob");
    registerColumnType(Types.LONGVARBINARY, "blob");
    // registerColumnType(Types.NULL, "null");
    registerColumnType(Types.BLOB, "blob");
    registerColumnType(Types.CLOB, "clob");
    registerColumnType(Types.BOOLEAN, "integer");

    registerFunction( "concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", "") );
    registerFunction( "mod", new SQLFunctionTemplate( StringType.INSTANCE, "?1 % ?2" ) );
    registerFunction( "substr", new StandardSQLFunction("substr", StringType.INSTANCE) );
    registerFunction( "substring", new StandardSQLFunction( "substr", StringType.INSTANCE) );
}
 
public CustomOracleSpatialDialect() {
	super();

	InlineFunctionRegistrationManager.registerInlineFunctions(this);

	registerFunction("dwithin", new StandardSQLFunction("SDO_WITHIN_DISTANCE", StandardBasicTypes.STRING));
	registerFunction("spatial_contains", new StandardSQLFunction("SDO_CONTAINS", StandardBasicTypes.BOOLEAN));
	registerFunction("intersection", new StandardSQLFunction("SDO_GEOM.SDO_INTERSECTION", GeometryUserType.TYPE));
	registerFunction("spatial_nn", new StandardSQLFunction("SDO_NN", StandardBasicTypes.BIG_DECIMAL));
	registerFunction("length_spa", new StandardSQLFunction("SDO_GEOM.SDO_LENGTH", StandardBasicTypes.BIG_DECIMAL));
	registerFunction("filter", new StandardSQLFunction("SDO_FILTER", StandardBasicTypes.STRING));
	registerFunction("distance", new StandardSQLFunction("SDO_GEOM.SDO_DISTANCE", StandardBasicTypes.BIG_DECIMAL));
	registerFunction("union", new StandardSQLFunction("SDO_GEOM.SDO_UNION", GeometryUserType.TYPE));
	registerFunction("centroid", new StandardSQLFunction("SDO_GEOM.SDO_CENTROID", GeometryUserType.TYPE));
	registerFunction("covers", new StandardSQLFunction("SDO_COVERS", StandardBasicTypes.STRING));
	registerFunction("coveredby", new StandardSQLFunction("SDO_COVEREDBY", StandardBasicTypes.STRING));
	registerFunction("relate", new StandardSQLFunction("SDO_GEOM.RELATE", StandardBasicTypes.STRING));
	registerFunction("inside", new StandardSQLFunction("SDO_INSIDE", StandardBasicTypes.STRING));
	registerFunction("to_km", new SQLFunctionTemplate(StandardBasicTypes.BIG_DECIMAL, "((?1) * 1.852)"));
	registerFunction("to_nm", new SQLFunctionTemplate(StandardBasicTypes.BIG_DECIMAL, "((?1) / 1.852)"));
	registerFunction("extract", new SQLFunctionTemplate(StandardBasicTypes.LONG, "extract (?1 from (?2))"));
	registerFunction("to_timezone", new SQLFunctionTemplate(StandardBasicTypes.TIMESTAMP, "((?1) + ?2/24)") {
		@Override
		public String render(Type argumentType, List args, SessionFactoryImplementor factory) {
			if (args == null || args.size() != 2) {
				throw new QueryException("to_timezone() requires two arguments");
			}
			if (!((String) args.get(1)).matches("\\-?((1?[0-9])|(2[0-3]))")) {
				throw new QueryException("to_timezone()'s second parameter must be a number from -23 to +23");
			}
			return super.render(argumentType, args, factory);
		}
	});
	registerFunction("latitude", new SQLFunctionTemplate(StandardBasicTypes.STRING, "CASE ?1.Get_GType() WHEN 1 THEN to_char(?1.sdo_point.y) ELSE '' END"));
	registerFunction("longitude",
			new SQLFunctionTemplate(StandardBasicTypes.STRING, "CASE ?1.Get_GType() WHEN 1 THEN to_char(?1.sdo_point.x) ELSE '' END"));
}
 
源代码12 项目: wangmarket   文件: SQLiteDialect.java
public SQLiteDialect() {
	super();
	registerColumnType(Types.BIT, "integer");
	registerColumnType(Types.TINYINT, "tinyint");
	registerColumnType(Types.SMALLINT, "smallint");
	registerColumnType(Types.INTEGER, "integer");
	registerColumnType(Types.BIGINT, "bigint");
	registerColumnType(Types.FLOAT, "float");
	registerColumnType(Types.REAL, "real");
	registerColumnType(Types.DOUBLE, "double");
	registerColumnType(Types.NUMERIC, "numeric");
	registerColumnType(Types.DECIMAL, "decimal");
	registerColumnType(Types.CHAR, "char");
	registerColumnType(Types.VARCHAR, 255, "varchar($l)");
	registerColumnType(Types.LONGVARCHAR, "longvarchar");
	registerColumnType(Types.DATE, "date");
	registerColumnType(Types.TIME, "time");
	registerColumnType(Types.TIMESTAMP, "timestamp");
	registerColumnType(Types.BINARY, "blob");
	registerColumnType(Types.VARBINARY, "blob");
	registerColumnType(Types.LONGVARBINARY, "blob");
	registerColumnType(Types.BLOB, "blob");
	registerColumnType(Types.CLOB, "clob");
	registerColumnType(Types.BOOLEAN, "integer");
	registerHibernateType(Types.NULL, "null");
	
	registerFunction("concat", new VarArgsSQLFunction(StringType.INSTANCE,
			"", "||", ""));
	registerFunction("mod", new SQLFunctionTemplate(IntegerType.INSTANCE,
			"?1 % ?2"));
	registerFunction("substr", new StandardSQLFunction("substr",
			StringType.INSTANCE));
	registerFunction("substring", new StandardSQLFunction("substr",
			StringType.INSTANCE));
}
 
源代码13 项目: dhis2-core   文件: DhisPostgresDialect.java
public DhisPostgresDialect()
{
    registerColumnType( Types.JAVA_OBJECT, "jsonb" );
    registerHibernateType( Types.OTHER, "pg-uuid" );
    registerFunction( "jsonb_extract_path", new StandardSQLFunction( "jsonb_extract_path", StandardBasicTypes.STRING ) );
    registerFunction( "jsonb_extract_path_text", new StandardSQLFunction( "jsonb_extract_path_text", StandardBasicTypes.STRING ) );
}
 
源代码14 项目: cacheonix-core   文件: TimesTenDialect.java
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") );

}
 
源代码15 项目: cacheonix-core   文件: MckoiDialect.java
public MckoiDialect() {
	super();
	registerColumnType( Types.BIT, "bit" );
	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" );
	registerColumnType( Types.NUMERIC, "numeric" );
	registerColumnType( Types.BLOB, "blob" );
	registerColumnType( Types.CLOB, "clob" );

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

	getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
}
 
@Override
public void contribute(MetadataBuilder metadataBuilder) {
    metadataBuilder.applySqlFunction(
        "group_concat",
        new StandardSQLFunction("group_concat", StandardBasicTypes.STRING)
    );
}
 
public CustomMySQLDialect() {
    super();

    registerFunction(
            "group_concat",
            new StandardSQLFunction("group_concat", StandardBasicTypes.STRING)
    );
}
 
@Override
protected void additionalMetadata(MetadataBuilder metadataBuilder) {
    metadataBuilder.applySqlFunction(
        "group_concat",
        new StandardSQLFunction("group_concat", StandardBasicTypes.STRING)
    );
}
 
源代码19 项目: webdsl   文件: SQLiteDialect.java
public SQLiteDialect() {
	super();
	registerColumnType(Types.BIT, "integer");
	registerColumnType(Types.TINYINT, "tinyint");
	registerColumnType(Types.SMALLINT, "smallint");
	registerColumnType(Types.INTEGER, "integer");
	registerColumnType(Types.BIGINT, "bigint");
	registerColumnType(Types.FLOAT, "float");
	registerColumnType(Types.REAL, "real");
	registerColumnType(Types.DOUBLE, "double");
	registerColumnType(Types.NUMERIC, "numeric");
	registerColumnType(Types.DECIMAL, "decimal");
	registerColumnType(Types.CHAR, "char");
	registerColumnType(Types.VARCHAR, "varchar");
	registerColumnType(Types.LONGVARCHAR, "longvarchar");
	registerColumnType(Types.DATE, "date");
	registerColumnType(Types.TIME, "time");
	registerColumnType(Types.TIMESTAMP, "timestamp");
	registerColumnType(Types.BINARY, "blob");
	registerColumnType(Types.VARBINARY, "blob");
	registerColumnType(Types.LONGVARBINARY, "blob");
	// registerColumnType(Types.NULL, "null");
	registerColumnType(Types.BLOB, "blob");
	registerColumnType(Types.CLOB, "clob");
	registerColumnType(Types.BOOLEAN, "integer");

	registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "",
			"||", ""));
	registerFunction("mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER,
			"?1 % ?2"));
	registerFunction("substr", new StandardSQLFunction("substr",
			StandardBasicTypes.STRING));
	registerFunction("substring", new StandardSQLFunction("substr",
			StandardBasicTypes.STRING));
}
 
源代码20 项目: unitime   文件: HibernateUtil.java
public static void addBitwiseOperationsToDialect() {
	SessionFactoryImplementor hibSessionFactory = (SessionFactoryImplementor)new _RootDAO().getSession().getSessionFactory();
	Dialect dialect = hibSessionFactory.getDialect();
	if (!dialect.getFunctions().containsKey("bit_and")) {
		if (isOracle())
			dialect.getFunctions().put("bit_and", new StandardSQLFunction("bitand", IntegerType.INSTANCE));
		else if (isPostgress())
			dialect.getFunctions().put("bit_and", new SQLFunctionTemplate(IntegerType.INSTANCE, "cast(?1 as int) & cast(?2 as int)"));
		else
			dialect.getFunctions().put("bit_and", new SQLFunctionTemplate(IntegerType.INSTANCE, "?1 & ?2"));
	}
}
 
源代码21 项目: poli-libras   文件: SQLiteDialect.java
public SQLiteDialect() {
	super();
	registerColumnType(Types.BIT, "integer");
	registerColumnType(Types.TINYINT, "tinyint");
	registerColumnType(Types.SMALLINT, "smallint");
	registerColumnType(Types.INTEGER, "integer");
	registerColumnType(Types.BIGINT, "bigint");
	registerColumnType(Types.FLOAT, "float");
	registerColumnType(Types.REAL, "real");
	registerColumnType(Types.DOUBLE, "double");
	registerColumnType(Types.NUMERIC, "numeric");
	registerColumnType(Types.DECIMAL, "decimal");
	registerColumnType(Types.CHAR, "char");
	registerColumnType(Types.VARCHAR, "varchar");
	registerColumnType(Types.LONGVARCHAR, "longvarchar");
	registerColumnType(Types.DATE, "date");
	registerColumnType(Types.TIME, "time");
	registerColumnType(Types.TIMESTAMP, "timestamp");
	registerColumnType(Types.BINARY, "blob");
	registerColumnType(Types.VARBINARY, "blob");
	registerColumnType(Types.LONGVARBINARY, "blob");
	// registerColumnType(Types.NULL, "null");
	registerColumnType(Types.BLOB, "blob");
	registerColumnType(Types.CLOB, "clob");
	registerColumnType(Types.BOOLEAN, "integer");

	 registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
	 registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
	 registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
	 registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
}
 
源代码22 项目: butterfly   文件: SQLiteDialect.java
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") );
}
 
源代码23 项目: lams   文件: MimerSQLDialect.java
/**
 * Even thoug Mimer SQL supports character and binary columns up to 15 000 in lenght,
 * this is also the maximum width of the table (exluding LOBs). To avoid breaking the limit all the
 * time we limit the length of the character columns to CHAR_MAX_LENTH, NATIONAL_CHAR_LENGTH for national
 * characters, and BINARY_MAX_LENGTH for binary types.
 */
public MimerSQLDialect() {
	super();
	registerColumnType( Types.BIT, "ODBC.BIT" );
	registerColumnType( Types.BIGINT, "BIGINT" );
	registerColumnType( Types.SMALLINT, "SMALLINT" );
	registerColumnType( Types.TINYINT, "ODBC.TINYINT" );
	registerColumnType( Types.INTEGER, "INTEGER" );
	registerColumnType( Types.CHAR, "NCHAR(1)" );
	registerColumnType( Types.VARCHAR, NATIONAL_CHAR_LENGTH, "NATIONAL CHARACTER VARYING($l)" );
	registerColumnType( Types.VARCHAR, "NCLOB($l)" );
	registerColumnType( Types.LONGVARCHAR, "CLOB($1)" );
	registerColumnType( Types.FLOAT, "FLOAT" );
	registerColumnType( Types.DOUBLE, "DOUBLE PRECISION" );
	registerColumnType( Types.DATE, "DATE" );
	registerColumnType( Types.TIME, "TIME" );
	registerColumnType( Types.TIMESTAMP, "TIMESTAMP" );
	registerColumnType( Types.VARBINARY, BINARY_MAX_LENGTH, "BINARY VARYING($l)" );
	registerColumnType( Types.VARBINARY, "BLOB($1)" );
	registerColumnType( Types.LONGVARBINARY, "BLOB($1)" );
	registerColumnType( Types.BINARY, BINARY_MAX_LENGTH, "BINARY" );
	registerColumnType( Types.BINARY, "BLOB($1)" );
	registerColumnType( Types.NUMERIC, "NUMERIC(19, $l)" );
	registerColumnType( Types.BLOB, "BLOB($l)" );
	registerColumnType( Types.CLOB, "NCLOB($l)" );

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

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

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


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

	registerFunction( "ascii_char", new StandardSQLFunction( "ascii_char", StandardBasicTypes.CHARACTER ) );
	registerFunction( "ascii_code", new StandardSQLFunction( "ascii_code", StandardBasicTypes.STRING ) );
	registerFunction( "unicode_char", new StandardSQLFunction( "unicode_char", StandardBasicTypes.LONG ) );
	registerFunction( "unicode_code", new StandardSQLFunction( "unicode_code", StandardBasicTypes.STRING ) );
	registerFunction( "upper", new StandardSQLFunction( "upper" ) );
	registerFunction( "lower", new StandardSQLFunction( "lower" ) );
	registerFunction( "char_length", new StandardSQLFunction( "char_length", StandardBasicTypes.LONG ) );
	registerFunction( "bit_length", new StandardSQLFunction( "bit_length", StandardBasicTypes.STRING ) );

	getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" );
	getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, "50" );
}
 
源代码24 项目: lams   文件: Oracle8iDialect.java
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) );
}
 
源代码25 项目: lams   文件: SAPDBDialect.java
/**
 * 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 );

}
 
源代码26 项目: lams   文件: MariaDB103Dialect.java
public MariaDB103Dialect() {
	super();

	this.registerFunction( "chr", new StandardSQLFunction( "chr", StandardBasicTypes.CHARACTER) );
}
 
源代码27 项目: lams   文件: FirebirdDialect.java
public FirebirdDialect() {
	super();
	registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
}
 
源代码28 项目: lams   文件: AbstractTransactSQLDialect.java
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 );
}
 
源代码29 项目: lams   文件: PostgreSQL81Dialect.java
/**
 * 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" );
}
 
源代码30 项目: lams   文件: Dialect.java
protected Dialect() {
	LOG.usingDialect( this );
	StandardAnsiSqlAggregationFunctions.primeFunctionMap( sqlFunctions );

	// standard sql92 functions (can be overridden by subclasses)
	registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1, ?2, ?3)" ) );
	registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "locate(?1, ?2, ?3)" ) );
	registerFunction( "trim", new SQLFunctionTemplate( StandardBasicTypes.STRING, "trim(?1 ?2 ?3 ?4)" ) );
	registerFunction( "length", new StandardSQLFunction( "length", StandardBasicTypes.INTEGER ) );
	registerFunction( "bit_length", new StandardSQLFunction( "bit_length", StandardBasicTypes.INTEGER ) );
	registerFunction( "coalesce", new StandardSQLFunction( "coalesce" ) );
	registerFunction( "nullif", new StandardSQLFunction( "nullif" ) );
	registerFunction( "abs", new StandardSQLFunction( "abs" ) );
	registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER) );
	registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE) );
	registerFunction( "upper", new StandardSQLFunction("upper") );
	registerFunction( "lower", new StandardSQLFunction("lower") );
	registerFunction( "cast", new CastFunction() );
	registerFunction( "extract", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(?1 ?2 ?3)") );

	//map second/minute/hour/day/month/year to ANSI extract(), override on subclasses
	registerFunction( "second", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(second from ?1)") );
	registerFunction( "minute", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(minute from ?1)") );
	registerFunction( "hour", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(hour from ?1)") );
	registerFunction( "day", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(day from ?1)") );
	registerFunction( "month", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(month from ?1)") );
	registerFunction( "year", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(year from ?1)") );

	registerFunction( "str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as char)") );

	registerColumnType( Types.BIT, "bit" );
	registerColumnType( Types.BOOLEAN, "boolean" );
	registerColumnType( Types.TINYINT, "tinyint" );
	registerColumnType( Types.SMALLINT, "smallint" );
	registerColumnType( Types.INTEGER, "integer" );
	registerColumnType( Types.BIGINT, "bigint" );
	registerColumnType( Types.FLOAT, "float($p)" );
	registerColumnType( Types.DOUBLE, "double precision" );
	registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
	registerColumnType( Types.REAL, "real" );

	registerColumnType( Types.DATE, "date" );
	registerColumnType( Types.TIME, "time" );
	registerColumnType( Types.TIMESTAMP, "timestamp" );

	registerColumnType( Types.VARBINARY, "bit varying($l)" );
	registerColumnType( Types.LONGVARBINARY, "bit varying($l)" );
	registerColumnType( Types.BLOB, "blob" );

	registerColumnType( Types.CHAR, "char($l)" );
	registerColumnType( Types.VARCHAR, "varchar($l)" );
	registerColumnType( Types.LONGVARCHAR, "varchar($l)" );
	registerColumnType( Types.CLOB, "clob" );

	registerColumnType( Types.NCHAR, "nchar($l)" );
	registerColumnType( Types.NVARCHAR, "nvarchar($l)" );
	registerColumnType( Types.LONGNVARCHAR, "nvarchar($l)" );
	registerColumnType( Types.NCLOB, "nclob" );

	// register hibernate types for default use in scalar sqlquery type auto detection
	registerHibernateType( Types.BIGINT, StandardBasicTypes.BIG_INTEGER.getName() );
	registerHibernateType( Types.BINARY, StandardBasicTypes.BINARY.getName() );
	registerHibernateType( Types.BIT, StandardBasicTypes.BOOLEAN.getName() );
	registerHibernateType( Types.BOOLEAN, StandardBasicTypes.BOOLEAN.getName() );
	registerHibernateType( Types.CHAR, StandardBasicTypes.CHARACTER.getName() );
	registerHibernateType( Types.CHAR, 1, StandardBasicTypes.CHARACTER.getName() );
	registerHibernateType( Types.CHAR, 255, StandardBasicTypes.STRING.getName() );
	registerHibernateType( Types.DATE, StandardBasicTypes.DATE.getName() );
	registerHibernateType( Types.DOUBLE, StandardBasicTypes.DOUBLE.getName() );
	registerHibernateType( Types.FLOAT, StandardBasicTypes.FLOAT.getName() );
	registerHibernateType( Types.INTEGER, StandardBasicTypes.INTEGER.getName() );
	registerHibernateType( Types.SMALLINT, StandardBasicTypes.SHORT.getName() );
	registerHibernateType( Types.TINYINT, StandardBasicTypes.BYTE.getName() );
	registerHibernateType( Types.TIME, StandardBasicTypes.TIME.getName() );
	registerHibernateType( Types.TIMESTAMP, StandardBasicTypes.TIMESTAMP.getName() );
	registerHibernateType( Types.VARCHAR, StandardBasicTypes.STRING.getName() );
	registerHibernateType( Types.NVARCHAR, StandardBasicTypes.NSTRING.getName() );
	registerHibernateType( Types.VARBINARY, StandardBasicTypes.BINARY.getName() );
	registerHibernateType( Types.LONGVARCHAR, StandardBasicTypes.TEXT.getName() );
	registerHibernateType( Types.LONGVARBINARY, StandardBasicTypes.IMAGE.getName() );
	registerHibernateType( Types.NUMERIC, StandardBasicTypes.BIG_DECIMAL.getName() );
	registerHibernateType( Types.DECIMAL, StandardBasicTypes.BIG_DECIMAL.getName() );
	registerHibernateType( Types.BLOB, StandardBasicTypes.BLOB.getName() );
	registerHibernateType( Types.CLOB, StandardBasicTypes.CLOB.getName() );
	registerHibernateType( Types.REAL, StandardBasicTypes.FLOAT.getName() );

	if(supportsPartitionBy()) {
		registerKeyword( "PARTITION" );
	}

	uniqueDelegate = new DefaultUniqueDelegate( this );
}