HHH-5509 - Leverage StandardBasicTypes internaly

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@20270 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2010-08-26 20:24:12 +00:00
parent a8c7b9c1f0
commit 07092e1caf
75 changed files with 1041 additions and 1066 deletions

View File

@ -1,11 +1,10 @@
//$Id: $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -21,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -32,7 +30,6 @@ import java.sql.Types;
import java.util.Map;
import java.util.Iterator;
import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.cfg.Environment;
@ -41,13 +38,13 @@ import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* An abstract base class for Sybase and MS SQL Server dialects.
*
* @author Gavin King
*/
/* package-private */
abstract class AbstractTransactSQLDialect extends Dialect {
public AbstractTransactSQLDialect() {
super();
@ -68,50 +65,50 @@ abstract class AbstractTransactSQLDialect extends Dialect {
registerColumnType( Types.BLOB, "image" );
registerColumnType( Types.CLOB, "text" );
registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
registerFunction( "char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
registerFunction( "len", new StandardSQLFunction("len", Hibernate.LONG) );
registerFunction( "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", Hibernate.STRING) );
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", Hibernate.STRING) );
registerFunction( "space", new StandardSQLFunction("space", StandardBasicTypes.STRING) );
registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING) );
registerFunction( "user", new NoArgSQLFunction("user", StandardBasicTypes.STRING) );
registerFunction( "current_timestamp", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
registerFunction( "current_time", new NoArgSQLFunction("getdate", Hibernate.TIME) );
registerFunction( "current_date", new NoArgSQLFunction("getdate", Hibernate.DATE) );
registerFunction( "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", Hibernate.TIMESTAMP) );
registerFunction( "getutcdate", new NoArgSQLFunction("getutcdate", Hibernate.TIMESTAMP) );
registerFunction( "day", new StandardSQLFunction("day", Hibernate.INTEGER) );
registerFunction( "month", new StandardSQLFunction("month", Hibernate.INTEGER) );
registerFunction( "year", new StandardSQLFunction("year", Hibernate.INTEGER) );
registerFunction( "datename", new StandardSQLFunction("datename", Hibernate.STRING) );
registerFunction( "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", Hibernate.INTEGER) );
registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
registerFunction( "cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE) );
registerFunction( "log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
registerFunction( "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", Hibernate.FLOAT) );
registerFunction( "rand", new StandardSQLFunction("rand", StandardBasicTypes.FLOAT) );
registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
registerFunction("radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE) );
registerFunction("degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE) );
registerFunction( "round", new StandardSQLFunction("round") );
registerFunction( "ceiling", new StandardSQLFunction("ceiling") );
@ -119,10 +116,10 @@ abstract class AbstractTransactSQLDialect extends Dialect {
registerFunction( "isnull", new StandardSQLFunction("isnull") );
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","+",")" ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(","+",")" ) );
registerFunction( "length", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "ltrim(rtrim(?1))") );
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);

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -29,7 +28,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.MappingException;
import org.hibernate.cfg.Environment;
@ -50,6 +48,7 @@ import org.hibernate.id.IdentityGenerator;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.sql.CacheJoinFragment;
import org.hibernate.sql.JoinFragment;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.StringHelper;
/**
@ -256,132 +255,132 @@ public class Cache71Dialect extends Dialect {
getDefaultProperties().setProperty( Environment.USE_SQL_COMMENTS, "false" );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
registerFunction( "acos", new StandardJDBCEscapeFunction( "acos", Hibernate.DOUBLE ) );
registerFunction( "%alphaup", new StandardSQLFunction( "%alphaup", Hibernate.STRING ) );
registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.STRING ) );
registerFunction( "asin", new StandardJDBCEscapeFunction( "asin", Hibernate.DOUBLE ) );
registerFunction( "atan", new StandardJDBCEscapeFunction( "atan", Hibernate.DOUBLE ) );
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "($length(?1)*8)" ) );
registerFunction( "acos", new StandardJDBCEscapeFunction( "acos", StandardBasicTypes.DOUBLE ) );
registerFunction( "%alphaup", new StandardSQLFunction( "%alphaup", StandardBasicTypes.STRING ) );
registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.STRING ) );
registerFunction( "asin", new StandardJDBCEscapeFunction( "asin", StandardBasicTypes.DOUBLE ) );
registerFunction( "atan", new StandardJDBCEscapeFunction( "atan", StandardBasicTypes.DOUBLE ) );
registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "($length(?1)*8)" ) );
// hibernate impelemnts cast in Dialect.java
registerFunction( "ceiling", new StandardSQLFunction( "ceiling", Hibernate.INTEGER ) );
registerFunction( "char", new StandardJDBCEscapeFunction( "char", Hibernate.CHARACTER ) );
registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.INTEGER ) );
registerFunction( "char_length", new StandardSQLFunction( "char_length", Hibernate.INTEGER ) );
registerFunction( "cos", new StandardJDBCEscapeFunction( "cos", Hibernate.DOUBLE ) );
registerFunction( "cot", new StandardJDBCEscapeFunction( "cot", Hibernate.DOUBLE ) );
registerFunction( "ceiling", new StandardSQLFunction( "ceiling", StandardBasicTypes.INTEGER ) );
registerFunction( "char", new StandardJDBCEscapeFunction( "char", StandardBasicTypes.CHARACTER ) );
registerFunction( "character_length", new StandardSQLFunction( "character_length", StandardBasicTypes.INTEGER ) );
registerFunction( "char_length", new StandardSQLFunction( "char_length", StandardBasicTypes.INTEGER ) );
registerFunction( "cos", new StandardJDBCEscapeFunction( "cos", StandardBasicTypes.DOUBLE ) );
registerFunction( "cot", new StandardJDBCEscapeFunction( "cot", StandardBasicTypes.DOUBLE ) );
registerFunction( "coalesce", new VarArgsSQLFunction( "coalesce(", ",", ")" ) );
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "", "||", "" ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "||", "" ) );
registerFunction( "convert", new ConvertFunction() );
registerFunction( "curdate", new StandardJDBCEscapeFunction( "curdate", Hibernate.DATE ) );
registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
registerFunction( "curdate", new StandardJDBCEscapeFunction( "curdate", StandardBasicTypes.DATE ) );
registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );
registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME, false ) );
registerFunction(
"current_timestamp", new ConditionalParenthesisFunction( "current_timestamp", Hibernate.TIMESTAMP )
"current_timestamp", new ConditionalParenthesisFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP )
);
registerFunction( "curtime", new StandardJDBCEscapeFunction( "curtime", Hibernate.TIME ) );
registerFunction( "database", new StandardJDBCEscapeFunction( "database", Hibernate.STRING ) );
registerFunction( "dateadd", new VarArgsSQLFunction( Hibernate.TIMESTAMP, "dateadd(", ",", ")" ) );
registerFunction( "datediff", new VarArgsSQLFunction( Hibernate.INTEGER, "datediff(", ",", ")" ) );
registerFunction( "datename", new VarArgsSQLFunction( Hibernate.STRING, "datename(", ",", ")" ) );
registerFunction( "datepart", new VarArgsSQLFunction( Hibernate.INTEGER, "datepart(", ",", ")" ) );
registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
registerFunction( "dayname", new StandardJDBCEscapeFunction( "dayname", Hibernate.STRING ) );
registerFunction( "dayofmonth", new StandardJDBCEscapeFunction( "dayofmonth", Hibernate.INTEGER ) );
registerFunction( "dayofweek", new StandardJDBCEscapeFunction( "dayofweek", Hibernate.INTEGER ) );
registerFunction( "dayofyear", new StandardJDBCEscapeFunction( "dayofyear", Hibernate.INTEGER ) );
registerFunction( "curtime", new StandardJDBCEscapeFunction( "curtime", StandardBasicTypes.TIME ) );
registerFunction( "database", new StandardJDBCEscapeFunction( "database", StandardBasicTypes.STRING ) );
registerFunction( "dateadd", new VarArgsSQLFunction( StandardBasicTypes.TIMESTAMP, "dateadd(", ",", ")" ) );
registerFunction( "datediff", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "datediff(", ",", ")" ) );
registerFunction( "datename", new VarArgsSQLFunction( StandardBasicTypes.STRING, "datename(", ",", ")" ) );
registerFunction( "datepart", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "datepart(", ",", ")" ) );
registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
registerFunction( "dayname", new StandardJDBCEscapeFunction( "dayname", StandardBasicTypes.STRING ) );
registerFunction( "dayofmonth", new StandardJDBCEscapeFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
registerFunction( "dayofweek", new StandardJDBCEscapeFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
registerFunction( "dayofyear", new StandardJDBCEscapeFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
// is it necessary to register %exact since it can only appear in a where clause?
registerFunction( "%exact", new StandardSQLFunction( "%exact", Hibernate.STRING ) );
registerFunction( "exp", new StandardJDBCEscapeFunction( "exp", Hibernate.DOUBLE ) );
registerFunction( "%external", new StandardSQLFunction( "%external", Hibernate.STRING ) );
registerFunction( "$extract", new VarArgsSQLFunction( Hibernate.INTEGER, "$extract(", ",", ")" ) );
registerFunction( "$find", new VarArgsSQLFunction( Hibernate.INTEGER, "$find(", ",", ")" ) );
registerFunction( "floor", new StandardSQLFunction( "floor", Hibernate.INTEGER ) );
registerFunction( "getdate", new StandardSQLFunction( "getdate", Hibernate.TIMESTAMP ) );
registerFunction( "hour", new StandardJDBCEscapeFunction( "hour", Hibernate.INTEGER ) );
registerFunction( "%exact", new StandardSQLFunction( "%exact", StandardBasicTypes.STRING ) );
registerFunction( "exp", new StandardJDBCEscapeFunction( "exp", StandardBasicTypes.DOUBLE ) );
registerFunction( "%external", new StandardSQLFunction( "%external", StandardBasicTypes.STRING ) );
registerFunction( "$extract", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "$extract(", ",", ")" ) );
registerFunction( "$find", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "$find(", ",", ")" ) );
registerFunction( "floor", new StandardSQLFunction( "floor", StandardBasicTypes.INTEGER ) );
registerFunction( "getdate", new StandardSQLFunction( "getdate", StandardBasicTypes.TIMESTAMP ) );
registerFunction( "hour", new StandardJDBCEscapeFunction( "hour", StandardBasicTypes.INTEGER ) );
registerFunction( "ifnull", new VarArgsSQLFunction( "ifnull(", ",", ")" ) );
registerFunction( "%internal", new StandardSQLFunction( "%internal" ) );
registerFunction( "isnull", new VarArgsSQLFunction( "isnull(", ",", ")" ) );
registerFunction( "isnumeric", new StandardSQLFunction( "isnumeric", Hibernate.INTEGER ) );
registerFunction( "lcase", new StandardJDBCEscapeFunction( "lcase", Hibernate.STRING ) );
registerFunction( "left", new StandardJDBCEscapeFunction( "left", Hibernate.STRING ) );
registerFunction( "len", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
registerFunction( "isnumeric", new StandardSQLFunction( "isnumeric", StandardBasicTypes.INTEGER ) );
registerFunction( "lcase", new StandardJDBCEscapeFunction( "lcase", StandardBasicTypes.STRING ) );
registerFunction( "left", new StandardJDBCEscapeFunction( "left", StandardBasicTypes.STRING ) );
registerFunction( "len", new StandardSQLFunction( "len", StandardBasicTypes.INTEGER ) );
registerFunction( "$length", new VarArgsSQLFunction( "$length(", ",", ")" ) );
// aggregate functions shouldn't be registered, right?
//registerFunction( "list", new StandardSQLFunction("list",Hibernate.STRING) );
//registerFunction( "list", new StandardSQLFunction("list",StandardBasicTypes.STRING) );
// stopped on $list
registerFunction( "$list", new VarArgsSQLFunction( "$list(", ",", ")" ) );
registerFunction( "$listdata", new VarArgsSQLFunction( "$listdata(", ",", ")" ) );
registerFunction( "$listfind", new VarArgsSQLFunction( "$listfind(", ",", ")" ) );
registerFunction( "$listget", new VarArgsSQLFunction( "$listget(", ",", ")" ) );
registerFunction( "$listlength", new StandardSQLFunction( "$listlength", Hibernate.INTEGER ) );
registerFunction( "locate", new StandardSQLFunction( "$FIND", Hibernate.INTEGER ) );
registerFunction( "log", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
registerFunction( "log10", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
registerFunction( "$listlength", new StandardSQLFunction( "$listlength", StandardBasicTypes.INTEGER ) );
registerFunction( "locate", new StandardSQLFunction( "$FIND", StandardBasicTypes.INTEGER ) );
registerFunction( "log", new StandardJDBCEscapeFunction( "log", StandardBasicTypes.DOUBLE ) );
registerFunction( "log10", new StandardJDBCEscapeFunction( "log", StandardBasicTypes.DOUBLE ) );
registerFunction( "lower", new StandardSQLFunction( "lower" ) );
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
registerFunction( "minute", new StandardJDBCEscapeFunction( "minute", Hibernate.INTEGER ) );
registerFunction( "mod", new StandardJDBCEscapeFunction( "mod", Hibernate.DOUBLE ) );
registerFunction( "month", new StandardJDBCEscapeFunction( "month", Hibernate.INTEGER ) );
registerFunction( "monthname", new StandardJDBCEscapeFunction( "monthname", Hibernate.STRING ) );
registerFunction( "now", new StandardJDBCEscapeFunction( "monthname", Hibernate.TIMESTAMP ) );
registerFunction( "minute", new StandardJDBCEscapeFunction( "minute", StandardBasicTypes.INTEGER ) );
registerFunction( "mod", new StandardJDBCEscapeFunction( "mod", StandardBasicTypes.DOUBLE ) );
registerFunction( "month", new StandardJDBCEscapeFunction( "month", StandardBasicTypes.INTEGER ) );
registerFunction( "monthname", new StandardJDBCEscapeFunction( "monthname", StandardBasicTypes.STRING ) );
registerFunction( "now", new StandardJDBCEscapeFunction( "monthname", StandardBasicTypes.TIMESTAMP ) );
registerFunction( "nullif", new VarArgsSQLFunction( "nullif(", ",", ")" ) );
registerFunction( "nvl", new NvlFunction() );
registerFunction( "%odbcin", new StandardSQLFunction( "%odbcin" ) );
registerFunction( "%odbcout", new StandardSQLFunction( "%odbcin" ) );
registerFunction( "%pattern", new VarArgsSQLFunction( Hibernate.STRING, "", "%pattern", "" ) );
registerFunction( "pi", new StandardJDBCEscapeFunction( "pi", Hibernate.DOUBLE ) );
registerFunction( "$piece", new VarArgsSQLFunction( Hibernate.STRING, "$piece(", ",", ")" ) );
registerFunction( "position", new VarArgsSQLFunction( Hibernate.INTEGER, "position(", " in ", ")" ) );
registerFunction( "power", new VarArgsSQLFunction( Hibernate.STRING, "power(", ",", ")" ) );
registerFunction( "quarter", new StandardJDBCEscapeFunction( "quarter", Hibernate.INTEGER ) );
registerFunction( "repeat", new VarArgsSQLFunction( Hibernate.STRING, "repeat(", ",", ")" ) );
registerFunction( "replicate", new VarArgsSQLFunction( Hibernate.STRING, "replicate(", ",", ")" ) );
registerFunction( "right", new StandardJDBCEscapeFunction( "right", Hibernate.STRING ) );
registerFunction( "round", new VarArgsSQLFunction( Hibernate.FLOAT, "round(", ",", ")" ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim", Hibernate.STRING ) );
registerFunction( "second", new StandardJDBCEscapeFunction( "second", Hibernate.INTEGER ) );
registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
registerFunction( "sin", new StandardJDBCEscapeFunction( "sin", Hibernate.DOUBLE ) );
registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
registerFunction( "%sqlstring", new VarArgsSQLFunction( Hibernate.STRING, "%sqlstring(", ",", ")" ) );
registerFunction( "%sqlupper", new VarArgsSQLFunction( Hibernate.STRING, "%sqlupper(", ",", ")" ) );
registerFunction( "sqrt", new StandardJDBCEscapeFunction( "SQRT", Hibernate.DOUBLE ) );
registerFunction( "%startswith", new VarArgsSQLFunction( Hibernate.STRING, "", "%startswith", "" ) );
registerFunction( "%pattern", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "%pattern", "" ) );
registerFunction( "pi", new StandardJDBCEscapeFunction( "pi", StandardBasicTypes.DOUBLE ) );
registerFunction( "$piece", new VarArgsSQLFunction( StandardBasicTypes.STRING, "$piece(", ",", ")" ) );
registerFunction( "position", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "position(", " in ", ")" ) );
registerFunction( "power", new VarArgsSQLFunction( StandardBasicTypes.STRING, "power(", ",", ")" ) );
registerFunction( "quarter", new StandardJDBCEscapeFunction( "quarter", StandardBasicTypes.INTEGER ) );
registerFunction( "repeat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "repeat(", ",", ")" ) );
registerFunction( "replicate", new VarArgsSQLFunction( StandardBasicTypes.STRING, "replicate(", ",", ")" ) );
registerFunction( "right", new StandardJDBCEscapeFunction( "right", StandardBasicTypes.STRING ) );
registerFunction( "round", new VarArgsSQLFunction( StandardBasicTypes.FLOAT, "round(", ",", ")" ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) );
registerFunction( "second", new StandardJDBCEscapeFunction( "second", StandardBasicTypes.INTEGER ) );
registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
registerFunction( "sin", new StandardJDBCEscapeFunction( "sin", StandardBasicTypes.DOUBLE ) );
registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
registerFunction( "%sqlstring", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%sqlstring(", ",", ")" ) );
registerFunction( "%sqlupper", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%sqlupper(", ",", ")" ) );
registerFunction( "sqrt", new StandardJDBCEscapeFunction( "SQRT", StandardBasicTypes.DOUBLE ) );
registerFunction( "%startswith", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "%startswith", "" ) );
// below is for Cache' that don't have str in 2007.1 there is str and we register str directly
registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as char varying)" ) );
registerFunction( "string", new VarArgsSQLFunction( Hibernate.STRING, "string(", ",", ")" ) );
registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as char varying)" ) );
registerFunction( "string", new VarArgsSQLFunction( StandardBasicTypes.STRING, "string(", ",", ")" ) );
// note that %string is deprecated
registerFunction( "%string", new VarArgsSQLFunction( Hibernate.STRING, "%string(", ",", ")" ) );
registerFunction( "substr", new VarArgsSQLFunction( Hibernate.STRING, "substr(", ",", ")" ) );
registerFunction( "substring", new VarArgsSQLFunction( Hibernate.STRING, "substring(", ",", ")" ) );
registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.TIMESTAMP, false ) );
registerFunction( "tan", new StandardJDBCEscapeFunction( "tan", Hibernate.DOUBLE ) );
registerFunction( "timestampadd", new StandardJDBCEscapeFunction( "timestampadd", Hibernate.DOUBLE ) );
registerFunction( "timestampdiff", new StandardJDBCEscapeFunction( "timestampdiff", Hibernate.DOUBLE ) );
registerFunction( "tochar", new VarArgsSQLFunction( Hibernate.STRING, "tochar(", ",", ")" ) );
registerFunction( "to_char", new VarArgsSQLFunction( Hibernate.STRING, "to_char(", ",", ")" ) );
registerFunction( "todate", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
registerFunction( "to_date", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
registerFunction( "%string", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%string(", ",", ")" ) );
registerFunction( "substr", new VarArgsSQLFunction( StandardBasicTypes.STRING, "substr(", ",", ")" ) );
registerFunction( "substring", new VarArgsSQLFunction( StandardBasicTypes.STRING, "substring(", ",", ")" ) );
registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.TIMESTAMP, false ) );
registerFunction( "tan", new StandardJDBCEscapeFunction( "tan", StandardBasicTypes.DOUBLE ) );
registerFunction( "timestampadd", new StandardJDBCEscapeFunction( "timestampadd", StandardBasicTypes.DOUBLE ) );
registerFunction( "timestampdiff", new StandardJDBCEscapeFunction( "timestampdiff", StandardBasicTypes.DOUBLE ) );
registerFunction( "tochar", new VarArgsSQLFunction( StandardBasicTypes.STRING, "tochar(", ",", ")" ) );
registerFunction( "to_char", new VarArgsSQLFunction( StandardBasicTypes.STRING, "to_char(", ",", ")" ) );
registerFunction( "todate", new VarArgsSQLFunction( StandardBasicTypes.STRING, "todate(", ",", ")" ) );
registerFunction( "to_date", new VarArgsSQLFunction( StandardBasicTypes.STRING, "todate(", ",", ")" ) );
registerFunction( "tonumber", new StandardSQLFunction( "tonumber" ) );
registerFunction( "to_number", new StandardSQLFunction( "tonumber" ) );
// TRIM(end_keyword string-expression-1 FROM string-expression-2)
// use Hibernate implementation "From" is one of the parameters they pass in position ?3
//registerFunction( "trim", new SQLFunctionTemplate(Hibernate.STRING, "trim(?1 ?2 from ?3)") );
registerFunction( "truncate", new StandardJDBCEscapeFunction( "truncate", Hibernate.STRING ) );
registerFunction( "ucase", new StandardJDBCEscapeFunction( "ucase", Hibernate.STRING ) );
//registerFunction( "trim", new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?1 ?2 from ?3)") );
registerFunction( "truncate", new StandardJDBCEscapeFunction( "truncate", StandardBasicTypes.STRING ) );
registerFunction( "ucase", new StandardJDBCEscapeFunction( "ucase", StandardBasicTypes.STRING ) );
registerFunction( "upper", new StandardSQLFunction( "upper" ) );
// %upper is deprecated
registerFunction( "%upper", new StandardSQLFunction( "%upper" ) );
registerFunction( "user", new StandardJDBCEscapeFunction( "user", Hibernate.STRING ) );
registerFunction( "week", new StandardJDBCEscapeFunction( "user", Hibernate.INTEGER ) );
registerFunction( "xmlconcat", new VarArgsSQLFunction( Hibernate.STRING, "xmlconcat(", ",", ")" ) );
registerFunction( "xmlelement", new VarArgsSQLFunction( Hibernate.STRING, "xmlelement(", ",", ")" ) );
registerFunction( "user", new StandardJDBCEscapeFunction( "user", StandardBasicTypes.STRING ) );
registerFunction( "week", new StandardJDBCEscapeFunction( "user", StandardBasicTypes.INTEGER ) );
registerFunction( "xmlconcat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "xmlconcat(", ",", ")" ) );
registerFunction( "xmlelement", new VarArgsSQLFunction( StandardBasicTypes.STRING, "xmlelement(", ",", ")" ) );
// xmlforest requires a new kind of function constructor
registerFunction( "year", new StandardJDBCEscapeFunction( "year", Hibernate.INTEGER ) );
registerFunction( "year", new StandardJDBCEscapeFunction( "year", StandardBasicTypes.INTEGER ) );
}
protected final void register71Functions() {
this.registerFunction( "str", new VarArgsSQLFunction( Hibernate.STRING, "str(", ",", ")" ) );
this.registerFunction( "str", new VarArgsSQLFunction( StandardBasicTypes.STRING, "str(", ",", ")" ) );
}
// DDL support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -29,7 +28,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.dialect.function.NoArgSQLFunction;
@ -37,6 +35,7 @@ import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect for DB2.
@ -69,86 +68,86 @@ public class DB2Dialect extends Dialect {
registerFunction("abs", new StandardSQLFunction("abs") );
registerFunction("absval", new StandardSQLFunction("absval") );
registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
registerFunction("sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction("ceiling", new StandardSQLFunction("ceiling") );
registerFunction("ceil", new StandardSQLFunction("ceil") );
registerFunction("floor", new StandardSQLFunction("floor") );
registerFunction("round", new StandardSQLFunction("round") );
registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
registerFunction("float", new StandardSQLFunction("float", Hibernate.DOUBLE) );
registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
registerFunction("stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
registerFunction("variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );
registerFunction("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("degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE) );
registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
registerFunction("float", new StandardSQLFunction("float", StandardBasicTypes.DOUBLE) );
registerFunction("hex", new StandardSQLFunction("hex", StandardBasicTypes.STRING) );
registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.DOUBLE) );
registerFunction("log10", new StandardSQLFunction("log10", StandardBasicTypes.DOUBLE) );
registerFunction("radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE) );
registerFunction("rand", new NoArgSQLFunction("rand", StandardBasicTypes.DOUBLE) );
registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
registerFunction("soundex", new StandardSQLFunction("soundex", StandardBasicTypes.STRING) );
registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
registerFunction("stddev", new StandardSQLFunction("stddev", StandardBasicTypes.DOUBLE) );
registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
registerFunction("variance", new StandardSQLFunction("variance", StandardBasicTypes.DOUBLE) );
registerFunction("julian_day", new StandardSQLFunction("julian_day", Hibernate.INTEGER) );
registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) );
registerFunction("midnight_seconds", new StandardSQLFunction("midnight_seconds", Hibernate.INTEGER) );
registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
registerFunction("current_date", new NoArgSQLFunction("current date", Hibernate.DATE, false) );
registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
registerFunction("dayofweek_iso", new StandardSQLFunction("dayofweek_iso", Hibernate.INTEGER) );
registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
registerFunction("days", new StandardSQLFunction("days", Hibernate.LONG) );
registerFunction("current_time", new NoArgSQLFunction("current time", Hibernate.TIME, false) );
registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
registerFunction("current_timestamp", new NoArgSQLFunction("current timestamp", Hibernate.TIMESTAMP, false) );
registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
registerFunction("timestamp_iso", new StandardSQLFunction("timestamp_iso", Hibernate.TIMESTAMP) );
registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
registerFunction("week_iso", new StandardSQLFunction("week_iso", Hibernate.INTEGER) );
registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );
registerFunction("julian_day", new StandardSQLFunction("julian_day", StandardBasicTypes.INTEGER) );
registerFunction("microsecond", new StandardSQLFunction("microsecond", StandardBasicTypes.INTEGER) );
registerFunction("midnight_seconds", new StandardSQLFunction("midnight_seconds", StandardBasicTypes.INTEGER) );
registerFunction("minute", new StandardSQLFunction("minute", StandardBasicTypes.INTEGER) );
registerFunction("month", new StandardSQLFunction("month", StandardBasicTypes.INTEGER) );
registerFunction("monthname", new StandardSQLFunction("monthname", StandardBasicTypes.STRING) );
registerFunction("quarter", new StandardSQLFunction("quarter", StandardBasicTypes.INTEGER) );
registerFunction("hour", new StandardSQLFunction("hour", StandardBasicTypes.INTEGER) );
registerFunction("second", new StandardSQLFunction("second", StandardBasicTypes.INTEGER) );
registerFunction("current_date", new NoArgSQLFunction("current date", StandardBasicTypes.DATE, false) );
registerFunction("date", new StandardSQLFunction("date", StandardBasicTypes.DATE) );
registerFunction("day", new StandardSQLFunction("day", StandardBasicTypes.INTEGER) );
registerFunction("dayname", new StandardSQLFunction("dayname", StandardBasicTypes.STRING) );
registerFunction("dayofweek", new StandardSQLFunction("dayofweek", StandardBasicTypes.INTEGER) );
registerFunction("dayofweek_iso", new StandardSQLFunction("dayofweek_iso", StandardBasicTypes.INTEGER) );
registerFunction("dayofyear", new StandardSQLFunction("dayofyear", StandardBasicTypes.INTEGER) );
registerFunction("days", new StandardSQLFunction("days", StandardBasicTypes.LONG) );
registerFunction("current_time", new NoArgSQLFunction("current time", StandardBasicTypes.TIME, false) );
registerFunction("time", new StandardSQLFunction("time", StandardBasicTypes.TIME) );
registerFunction("current_timestamp", new NoArgSQLFunction("current timestamp", StandardBasicTypes.TIMESTAMP, false) );
registerFunction("timestamp", new StandardSQLFunction("timestamp", StandardBasicTypes.TIMESTAMP) );
registerFunction("timestamp_iso", new StandardSQLFunction("timestamp_iso", StandardBasicTypes.TIMESTAMP) );
registerFunction("week", new StandardSQLFunction("week", StandardBasicTypes.INTEGER) );
registerFunction("week_iso", new StandardSQLFunction("week_iso", StandardBasicTypes.INTEGER) );
registerFunction("year", new StandardSQLFunction("year", StandardBasicTypes.INTEGER) );
registerFunction("double", new StandardSQLFunction("double", Hibernate.DOUBLE) );
registerFunction("varchar", new StandardSQLFunction("varchar", Hibernate.STRING) );
registerFunction("real", new StandardSQLFunction("real", Hibernate.FLOAT) );
registerFunction("bigint", new StandardSQLFunction("bigint", Hibernate.LONG) );
registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
registerFunction("integer", new StandardSQLFunction("integer", Hibernate.INTEGER) );
registerFunction("smallint", new StandardSQLFunction("smallint", Hibernate.SHORT) );
registerFunction("double", new StandardSQLFunction("double", StandardBasicTypes.DOUBLE) );
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("digits", new StandardSQLFunction("digits", Hibernate.STRING) );
registerFunction("chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
registerFunction("digits", new StandardSQLFunction("digits", StandardBasicTypes.STRING) );
registerFunction("chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER) );
registerFunction("upper", new StandardSQLFunction("upper") );
registerFunction("lower", new StandardSQLFunction("lower") );
registerFunction("ucase", new StandardSQLFunction("ucase") );
registerFunction("lcase", new StandardSQLFunction("lcase") );
registerFunction("ltrim", new StandardSQLFunction("ltrim") );
registerFunction("rtrim", new StandardSQLFunction("rtrim") );
registerFunction( "substr", new StandardSQLFunction( "substr", Hibernate.STRING ) );
registerFunction( "posstr", new StandardSQLFunction( "posstr", Hibernate.INTEGER ) );
registerFunction( "substr", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
registerFunction( "posstr", new StandardSQLFunction( "posstr", StandardBasicTypes.INTEGER ) );
registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "length(?1)*8" ) );
registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "length(?1)*8" ) );
registerFunction( "trim", new AnsiTrimEmulationFunction() );
registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
registerFunction( "concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", "") );
registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "rtrim(char(?1))" ) );
registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "rtrim(char(?1))" ) );
registerKeyword("current");
registerKeyword("date");

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -36,7 +36,6 @@ import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
@ -67,6 +66,7 @@ import org.hibernate.sql.ANSIJoinFragment;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.ForUpdateFragment;
import org.hibernate.sql.JoinFragment;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
@ -109,53 +109,53 @@ public abstract class Dialect {
StandardAnsiSqlAggregationFunctions.primeFunctionMap( sqlFunctions );
// standard sql92 functions (can be overridden by subclasses)
registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1, ?2, ?3)" ) );
registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "locate(?1, ?2, ?3)" ) );
registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "trim(?1 ?2 ?3 ?4)" ) );
registerFunction( "length", new StandardSQLFunction( "length", Hibernate.INTEGER ) );
registerFunction( "bit_length", new StandardSQLFunction( "bit_length", Hibernate.INTEGER ) );
registerFunction( "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", Hibernate.INTEGER) );
registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE) );
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(Hibernate.INTEGER, "extract(?1 ?2 ?3)") );
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(Hibernate.INTEGER, "extract(second from ?1)") );
registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(minute from ?1)") );
registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(hour from ?1)") );
registerFunction( "day", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(day from ?1)") );
registerFunction( "month", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(month from ?1)") );
registerFunction( "year", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(year from ?1)") );
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(Hibernate.STRING, "cast(?1 as char)") );
registerFunction( "str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as char)") );
// register hibernate types for default use in scalar sqlquery type auto detection
registerHibernateType( Types.BIGINT, Hibernate.BIG_INTEGER.getName() );
registerHibernateType( Types.BINARY, Hibernate.BINARY.getName() );
registerHibernateType( Types.BIT, Hibernate.BOOLEAN.getName() );
registerHibernateType( Types.CHAR, Hibernate.CHARACTER.getName() );
registerHibernateType( Types.DATE, Hibernate.DATE.getName() );
registerHibernateType( Types.DOUBLE, Hibernate.DOUBLE.getName() );
registerHibernateType( Types.FLOAT, Hibernate.FLOAT.getName() );
registerHibernateType( Types.INTEGER, Hibernate.INTEGER.getName() );
registerHibernateType( Types.SMALLINT, Hibernate.SHORT.getName() );
registerHibernateType( Types.TINYINT, Hibernate.BYTE.getName() );
registerHibernateType( Types.TIME, Hibernate.TIME.getName() );
registerHibernateType( Types.TIMESTAMP, Hibernate.TIMESTAMP.getName() );
registerHibernateType( Types.VARCHAR, Hibernate.STRING.getName() );
registerHibernateType( Types.VARBINARY, Hibernate.BINARY.getName() );
registerHibernateType( Types.LONGVARCHAR, Hibernate.TEXT.getName() );
registerHibernateType( Types.LONGVARBINARY, Hibernate.IMAGE.getName() );
registerHibernateType( Types.NUMERIC, Hibernate.BIG_DECIMAL.getName() );
registerHibernateType( Types.DECIMAL, Hibernate.BIG_DECIMAL.getName() );
registerHibernateType( Types.BLOB, Hibernate.BLOB.getName() );
registerHibernateType( Types.CLOB, Hibernate.CLOB.getName() );
registerHibernateType( Types.REAL, Hibernate.FLOAT.getName() );
registerHibernateType( Types.BIGINT, StandardBasicTypes.BIG_INTEGER.getName() );
registerHibernateType( Types.BINARY, StandardBasicTypes.BINARY.getName() );
registerHibernateType( Types.BIT, StandardBasicTypes.BOOLEAN.getName() );
registerHibernateType( Types.CHAR, StandardBasicTypes.CHARACTER.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.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() );
}
/**

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -29,7 +29,6 @@ import java.sql.Types;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.dialect.function.NoArgSQLFunction;
@ -37,6 +36,7 @@ import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
/**
@ -106,82 +106,82 @@ public class H2Dialect extends Dialect {
// see also -> http://www.h2database.com/html/functions.html
// Numeric Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
registerFunction( "acos", new StandardSQLFunction( "acos", Hibernate.DOUBLE ) );
registerFunction( "asin", new StandardSQLFunction( "asin", Hibernate.DOUBLE ) );
registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
registerFunction( "atan2", new StandardSQLFunction( "atan2", Hibernate.DOUBLE ) );
registerFunction( "bitand", new StandardSQLFunction( "bitand", Hibernate.INTEGER ) );
registerFunction( "bitor", new StandardSQLFunction( "bitor", Hibernate.INTEGER ) );
registerFunction( "bitxor", new StandardSQLFunction( "bitxor", Hibernate.INTEGER ) );
registerFunction( "ceiling", new StandardSQLFunction( "ceiling", Hibernate.DOUBLE ) );
registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
registerFunction( "compress", new StandardSQLFunction( "compress", Hibernate.BINARY ) );
registerFunction( "cot", new StandardSQLFunction( "cot", Hibernate.DOUBLE ) );
registerFunction( "decrypt", new StandardSQLFunction( "decrypt", Hibernate.BINARY ) );
registerFunction( "degrees", new StandardSQLFunction( "degrees", Hibernate.DOUBLE ) );
registerFunction( "encrypt", new StandardSQLFunction( "encrypt", Hibernate.BINARY ) );
registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
registerFunction( "expand", new StandardSQLFunction( "compress", Hibernate.BINARY ) );
registerFunction( "floor", new StandardSQLFunction( "floor", Hibernate.DOUBLE ) );
registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.BINARY ) );
registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
registerFunction( "log10", new StandardSQLFunction( "log10", Hibernate.DOUBLE ) );
registerFunction( "pi", new NoArgSQLFunction( "pi", Hibernate.DOUBLE ) );
registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
registerFunction( "radians", new StandardSQLFunction( "radians", Hibernate.DOUBLE ) );
registerFunction( "rand", new NoArgSQLFunction( "rand", Hibernate.DOUBLE ) );
registerFunction( "round", new StandardSQLFunction( "round", Hibernate.DOUBLE ) );
registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic", Hibernate.DOUBLE ) );
registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
registerFunction( "tan", new StandardSQLFunction( "tan", Hibernate.DOUBLE ) );
registerFunction( "truncate", new StandardSQLFunction( "truncate", Hibernate.DOUBLE ) );
registerFunction( "acos", new StandardSQLFunction( "acos", StandardBasicTypes.DOUBLE ) );
registerFunction( "asin", new StandardSQLFunction( "asin", StandardBasicTypes.DOUBLE ) );
registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) );
registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.DOUBLE ) );
registerFunction( "bitand", new StandardSQLFunction( "bitand", StandardBasicTypes.INTEGER ) );
registerFunction( "bitor", new StandardSQLFunction( "bitor", StandardBasicTypes.INTEGER ) );
registerFunction( "bitxor", new StandardSQLFunction( "bitxor", StandardBasicTypes.INTEGER ) );
registerFunction( "ceiling", new StandardSQLFunction( "ceiling", StandardBasicTypes.DOUBLE ) );
registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
registerFunction( "compress", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) );
registerFunction( "cot", new StandardSQLFunction( "cot", StandardBasicTypes.DOUBLE ) );
registerFunction( "decrypt", new StandardSQLFunction( "decrypt", StandardBasicTypes.BINARY ) );
registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) );
registerFunction( "encrypt", new StandardSQLFunction( "encrypt", StandardBasicTypes.BINARY ) );
registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
registerFunction( "expand", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) );
registerFunction( "floor", new StandardSQLFunction( "floor", StandardBasicTypes.DOUBLE ) );
registerFunction( "hash", new StandardSQLFunction( "hash", StandardBasicTypes.BINARY ) );
registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) );
registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) );
registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) );
registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.DOUBLE ) );
registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
registerFunction( "rand", new NoArgSQLFunction( "rand", StandardBasicTypes.DOUBLE ) );
registerFunction( "round", new StandardSQLFunction( "round", StandardBasicTypes.DOUBLE ) );
registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic", StandardBasicTypes.DOUBLE ) );
registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) );
registerFunction( "truncate", new StandardSQLFunction( "truncate", StandardBasicTypes.DOUBLE ) );
// String Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.INTEGER ) );
registerFunction( "char", new StandardSQLFunction( "char", Hibernate.CHARACTER ) );
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
registerFunction( "difference", new StandardSQLFunction( "difference", Hibernate.INTEGER ) );
registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw", Hibernate.STRING ) );
registerFunction( "insert", new StandardSQLFunction( "lower", Hibernate.STRING ) );
registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
registerFunction( "lcase", new StandardSQLFunction( "lcase", Hibernate.STRING ) );
registerFunction( "ltrim", new StandardSQLFunction( "ltrim", Hibernate.STRING ) );
registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.INTEGER ) );
registerFunction( "position", new StandardSQLFunction( "position", Hibernate.INTEGER ) );
registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex", Hibernate.STRING ) );
registerFunction( "repeat", new StandardSQLFunction( "repeat", Hibernate.STRING ) );
registerFunction( "replace", new StandardSQLFunction( "replace", Hibernate.STRING ) );
registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim", Hibernate.STRING ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
registerFunction( "stringencode", new StandardSQLFunction( "stringencode", Hibernate.STRING ) );
registerFunction( "stringdecode", new StandardSQLFunction( "stringdecode", Hibernate.STRING ) );
registerFunction( "stringtoutf8", new StandardSQLFunction( "stringtoutf8", Hibernate.BINARY ) );
registerFunction( "ucase", new StandardSQLFunction( "ucase", Hibernate.STRING ) );
registerFunction( "utf8tostring", new StandardSQLFunction( "utf8tostring", Hibernate.STRING ) );
registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.INTEGER ) );
registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
registerFunction( "difference", new StandardSQLFunction( "difference", StandardBasicTypes.INTEGER ) );
registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw", StandardBasicTypes.STRING ) );
registerFunction( "insert", new StandardSQLFunction( "lower", StandardBasicTypes.STRING ) );
registerFunction( "left", new StandardSQLFunction( "left", StandardBasicTypes.STRING ) );
registerFunction( "lcase", new StandardSQLFunction( "lcase", StandardBasicTypes.STRING ) );
registerFunction( "ltrim", new StandardSQLFunction( "ltrim", StandardBasicTypes.STRING ) );
registerFunction( "octet_length", new StandardSQLFunction( "octet_length", StandardBasicTypes.INTEGER ) );
registerFunction( "position", new StandardSQLFunction( "position", StandardBasicTypes.INTEGER ) );
registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex", StandardBasicTypes.STRING ) );
registerFunction( "repeat", new StandardSQLFunction( "repeat", StandardBasicTypes.STRING ) );
registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
registerFunction( "right", new StandardSQLFunction( "right", StandardBasicTypes.STRING ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
registerFunction( "stringencode", new StandardSQLFunction( "stringencode", StandardBasicTypes.STRING ) );
registerFunction( "stringdecode", new StandardSQLFunction( "stringdecode", StandardBasicTypes.STRING ) );
registerFunction( "stringtoutf8", new StandardSQLFunction( "stringtoutf8", StandardBasicTypes.BINARY ) );
registerFunction( "ucase", new StandardSQLFunction( "ucase", StandardBasicTypes.STRING ) );
registerFunction( "utf8tostring", new StandardSQLFunction( "utf8tostring", StandardBasicTypes.STRING ) );
// Time and Date Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
registerFunction( "curdate", new NoArgSQLFunction( "curdate", Hibernate.DATE ) );
registerFunction( "curtime", new NoArgSQLFunction( "curtime", Hibernate.TIME ) );
registerFunction( "curtimestamp", new NoArgSQLFunction( "curtimestamp", Hibernate.TIME ) );
registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE ) );
registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME ) );
registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP ) );
registerFunction( "datediff", new StandardSQLFunction( "datediff", Hibernate.INTEGER ) );
registerFunction( "dayname", new StandardSQLFunction( "dayname", Hibernate.STRING ) );
registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", Hibernate.INTEGER ) );
registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", Hibernate.INTEGER ) );
registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", Hibernate.INTEGER ) );
registerFunction( "monthname", new StandardSQLFunction( "monthname", Hibernate.STRING ) );
registerFunction( "now", new NoArgSQLFunction( "now", Hibernate.TIMESTAMP ) );
registerFunction( "quarter", new StandardSQLFunction( "quarter", Hibernate.INTEGER ) );
registerFunction( "week", new StandardSQLFunction( "week", Hibernate.INTEGER ) );
registerFunction( "curdate", new NoArgSQLFunction( "curdate", StandardBasicTypes.DATE ) );
registerFunction( "curtime", new NoArgSQLFunction( "curtime", StandardBasicTypes.TIME ) );
registerFunction( "curtimestamp", new NoArgSQLFunction( "curtimestamp", StandardBasicTypes.TIME ) );
registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE ) );
registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME ) );
registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP ) );
registerFunction( "datediff", new StandardSQLFunction( "datediff", StandardBasicTypes.INTEGER ) );
registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) );
registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) );
registerFunction( "now", new NoArgSQLFunction( "now", StandardBasicTypes.TIMESTAMP ) );
registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) );
registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) );
// System Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );
registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) );
registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING ) );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}

View File

@ -27,7 +27,6 @@ import java.sql.SQLException;
import java.sql.Types;
import java.io.Serializable;
import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.StaleObjectStateException;
import org.hibernate.JDBCException;
@ -43,6 +42,7 @@ import org.hibernate.dialect.lock.*;
import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
import org.slf4j.Logger;
@ -61,8 +61,6 @@ import org.slf4j.LoggerFactory;
* @author Fred Toussi
*/
public class HSQLDialect extends Dialect {
private static final Logger log = LoggerFactory.getLogger( HSQLDialect.class );
/**
@ -124,75 +122,75 @@ public class HSQLDialect extends Dialect {
registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) );
registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.INTEGER ) );
registerFunction( "char", new StandardSQLFunction( "char", Hibernate.CHARACTER ) );
registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.INTEGER ) );
registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) );
registerFunction( "lower", new StandardSQLFunction( "lower" ) );
registerFunction( "upper", new StandardSQLFunction( "upper" ) );
registerFunction( "lcase", new StandardSQLFunction( "lcase" ) );
registerFunction( "ucase", new StandardSQLFunction( "ucase" ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
registerFunction( "reverse", new StandardSQLFunction( "reverse" ) );
registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex" ) );
registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw" ) );
registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as varchar(24))" ) );
registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );
registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as varchar(24))" ) );
registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING ) );
registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) );
registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.DATE, false ) );
registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
registerFunction( "curdate", new NoArgSQLFunction( "curdate", Hibernate.DATE ) );
registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.DATE, false ) );
registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );
registerFunction( "curdate", new NoArgSQLFunction( "curdate", StandardBasicTypes.DATE ) );
registerFunction(
"current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP, false )
"current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP, false )
);
registerFunction( "now", new NoArgSQLFunction( "now", Hibernate.TIMESTAMP ) );
registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
registerFunction( "curtime", new NoArgSQLFunction( "curtime", Hibernate.TIME ) );
registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", Hibernate.INTEGER ) );
registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", Hibernate.INTEGER ) );
registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", Hibernate.INTEGER ) );
registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
registerFunction( "week", new StandardSQLFunction( "week", Hibernate.INTEGER ) );
registerFunction( "quarter", new StandardSQLFunction( "quarter", Hibernate.INTEGER ) );
registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
registerFunction( "dayname", new StandardSQLFunction( "dayname", Hibernate.STRING ) );
registerFunction( "monthname", new StandardSQLFunction( "monthname", Hibernate.STRING ) );
registerFunction( "now", new NoArgSQLFunction( "now", StandardBasicTypes.TIMESTAMP ) );
registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME, false ) );
registerFunction( "curtime", new NoArgSQLFunction( "curtime", StandardBasicTypes.TIME ) );
registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
registerFunction( "month", new StandardSQLFunction( "month", StandardBasicTypes.INTEGER ) );
registerFunction( "year", new StandardSQLFunction( "year", StandardBasicTypes.INTEGER ) );
registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) );
registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) );
registerFunction( "hour", new StandardSQLFunction( "hour", StandardBasicTypes.INTEGER ) );
registerFunction( "minute", new StandardSQLFunction( "minute", StandardBasicTypes.INTEGER ) );
registerFunction( "second", new StandardSQLFunction( "second", StandardBasicTypes.INTEGER ) );
registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) );
registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
registerFunction( "acos", new StandardSQLFunction( "acos", Hibernate.DOUBLE ) );
registerFunction( "asin", new StandardSQLFunction( "asin", Hibernate.DOUBLE ) );
registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
registerFunction( "cot", new StandardSQLFunction( "cot", Hibernate.DOUBLE ) );
registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
registerFunction( "log10", new StandardSQLFunction( "log10", Hibernate.DOUBLE ) );
registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
registerFunction( "tan", new StandardSQLFunction( "tan", Hibernate.DOUBLE ) );
registerFunction( "pi", new NoArgSQLFunction( "pi", Hibernate.DOUBLE ) );
registerFunction( "rand", new StandardSQLFunction( "rand", Hibernate.FLOAT ) );
registerFunction( "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( "rand", new StandardSQLFunction( "rand", StandardBasicTypes.FLOAT ) );
registerFunction( "radians", new StandardSQLFunction( "radians", Hibernate.DOUBLE ) );
registerFunction( "degrees", new StandardSQLFunction( "degrees", Hibernate.DOUBLE ) );
registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) );
registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic" ) );
registerFunction( "ceiling", new StandardSQLFunction( "ceiling" ) );
registerFunction( "floor", new StandardSQLFunction( "floor" ) );
// Multi-param dialect functions...
registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );
registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER ) );
// function templates
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -28,18 +27,18 @@ import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.MappingException;
import org.hibernate.Hibernate;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.StringHelper;
/**
* Informix dialect.<br>
* <br>
* Seems to work with Informix Dynamic Server Version 7.31.UD3,
* Informix JDBC driver version 2.21JC3.
* Seems to work with Informix Dynamic Server Version 7.31.UD3, Informix JDBC driver version 2.21JC3.
*
* @author Steve Molitor
*/
public class InformixDialect extends Dialect {
@ -73,7 +72,7 @@ public class InformixDialect extends Dialect {
registerColumnType(Types.VARCHAR, 255, "varchar($l)");
registerColumnType(Types.VARCHAR, 32739, "lvarchar($l)");
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
}
public String getAddColumnString() {

View File

@ -1,11 +1,32 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.dialect;
import java.sql.Types;
import java.util.Properties;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
/**
* A SQL dialect for Ingres 10 and later versions.

View File

@ -1,11 +1,33 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* A SQL dialect for Ingres 9.3 and later versions.
@ -21,23 +43,24 @@ import org.hibernate.dialect.function.VarArgsSQLFunction;
* <li>Modified concatination operator</li>
* </ul>
*
* @author Enrico Schenk, Raymond Fan
* @author Enrico Schenk
* @author Raymond Fan
*/
public class Ingres9Dialect extends IngresDialect {
public Ingres9Dialect() {
super();
registerDateTimeFunctions();
registerDateTimeColumnTypes();
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
}
/**
* Register functions current_time, current_timestamp, current_date
*/
protected void registerDateTimeFunctions() {
registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME, false));
registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false));
registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false));
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));
}
/**

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,18 +20,17 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect for Ingres 9.2.
@ -44,7 +43,10 @@ import org.hibernate.dialect.function.VarArgsSQLFunction;
* <li> Perform string casts to varchar; removes space padding.
* </ul>
*
* @author Ian Booth, Bruce Lunsford, Max Rydahl Andersen, Raymond Fan
* @author Ian Booth
* @author Bruce Lunsford
* @author Max Rydahl Andersen
* @author Raymond Fan
*/
public class IngresDialect extends Dialect {
@ -76,74 +78,74 @@ public class IngresDialect extends Dialect {
registerColumnType( Types.CLOB, "clob" );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) );
registerFunction( "bit_add", new StandardSQLFunction( "bit_add" ) );
registerFunction( "bit_and", new StandardSQLFunction( "bit_and" ) );
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "octet_length(hex(?1))*4" ) );
registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "octet_length(hex(?1))*4" ) );
registerFunction( "bit_not", new StandardSQLFunction( "bit_not" ) );
registerFunction( "bit_or", new StandardSQLFunction( "bit_or" ) );
registerFunction( "bit_xor", new StandardSQLFunction( "bit_xor" ) );
registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.LONG ) );
registerFunction( "charextract", new StandardSQLFunction( "charextract", Hibernate.STRING ) );
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "+", ")" ) );
registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
registerFunction( "current_user", new NoArgSQLFunction( "current_user", Hibernate.STRING, false ) );
registerFunction( "current_time", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
registerFunction( "current_date", new NoArgSQLFunction( "date('now')", Hibernate.TIMESTAMP, false ) );
registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", Hibernate.TIMESTAMP ) );
registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
registerFunction( "dba", new NoArgSQLFunction( "dba", Hibernate.STRING, true ) );
registerFunction( "dow", new StandardSQLFunction( "dow", Hibernate.STRING ) );
registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "date_part('?1', ?3)" ) );
registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", Hibernate.STRING ) );
registerFunction( "hash", new StandardSQLFunction( "hash", Hibernate.INTEGER ) );
registerFunction( "hex", new StandardSQLFunction( "hex", Hibernate.STRING ) );
registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", Hibernate.STRING, false ) );
registerFunction( "intextract", new StandardSQLFunction( "intextract", Hibernate.INTEGER ) );
registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING ) );
registerFunction( "locate", new SQLFunctionTemplate( Hibernate.LONG, "locate(?1, ?2)" ) );
registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
registerFunction( "ln", new StandardSQLFunction( "ln", Hibernate.DOUBLE ) );
registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
registerFunction( "character_length", new StandardSQLFunction( "character_length", StandardBasicTypes.LONG ) );
registerFunction( "charextract", new StandardSQLFunction( "charextract", StandardBasicTypes.STRING ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "+", ")" ) );
registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
registerFunction( "current_user", new NoArgSQLFunction( "current_user", StandardBasicTypes.STRING, false ) );
registerFunction( "current_time", new NoArgSQLFunction( "date('now')", StandardBasicTypes.TIMESTAMP, false ) );
registerFunction( "current_timestamp", new NoArgSQLFunction( "date('now')", StandardBasicTypes.TIMESTAMP, false ) );
registerFunction( "current_date", new NoArgSQLFunction( "date('now')", StandardBasicTypes.TIMESTAMP, false ) );
registerFunction( "date_trunc", new StandardSQLFunction( "date_trunc", StandardBasicTypes.TIMESTAMP ) );
registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
registerFunction( "dba", new NoArgSQLFunction( "dba", StandardBasicTypes.STRING, true ) );
registerFunction( "dow", new StandardSQLFunction( "dow", StandardBasicTypes.STRING ) );
registerFunction( "extract", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "date_part('?1', ?3)" ) );
registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
registerFunction( "gmt_timestamp", new StandardSQLFunction( "gmt_timestamp", StandardBasicTypes.STRING ) );
registerFunction( "hash", new StandardSQLFunction( "hash", StandardBasicTypes.INTEGER ) );
registerFunction( "hex", new StandardSQLFunction( "hex", StandardBasicTypes.STRING ) );
registerFunction( "hour", new StandardSQLFunction( "hour", StandardBasicTypes.INTEGER ) );
registerFunction( "initial_user", new NoArgSQLFunction( "initial_user", StandardBasicTypes.STRING, false ) );
registerFunction( "intextract", new StandardSQLFunction( "intextract", StandardBasicTypes.INTEGER ) );
registerFunction( "left", new StandardSQLFunction( "left", StandardBasicTypes.STRING ) );
registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.LONG, "locate(?1, ?2)" ) );
registerFunction( "length", new StandardSQLFunction( "length", StandardBasicTypes.LONG ) );
registerFunction( "ln", new StandardSQLFunction( "ln", StandardBasicTypes.DOUBLE ) );
registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) );
registerFunction( "lower", new StandardSQLFunction( "lower" ) );
registerFunction( "lowercase", new StandardSQLFunction( "lowercase" ) );
registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
registerFunction( "octet_length", new StandardSQLFunction( "octet_length", Hibernate.LONG ) );
registerFunction( "pad", new StandardSQLFunction( "pad", Hibernate.STRING ) );
registerFunction( "position", new StandardSQLFunction( "position", Hibernate.LONG ) );
registerFunction( "power", new StandardSQLFunction( "power", Hibernate.DOUBLE ) );
registerFunction( "random", new NoArgSQLFunction( "random", Hibernate.LONG, true ) );
registerFunction( "randomf", new NoArgSQLFunction( "randomf", Hibernate.DOUBLE, true ) );
registerFunction( "right", new StandardSQLFunction( "right", Hibernate.STRING ) );
registerFunction( "session_user", new NoArgSQLFunction( "session_user", Hibernate.STRING, false ) );
registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
registerFunction( "size", new NoArgSQLFunction( "size", Hibernate.LONG, true ) );
registerFunction( "minute", new StandardSQLFunction( "minute", StandardBasicTypes.INTEGER ) );
registerFunction( "month", new StandardSQLFunction( "month", StandardBasicTypes.INTEGER ) );
registerFunction( "octet_length", new StandardSQLFunction( "octet_length", StandardBasicTypes.LONG ) );
registerFunction( "pad", new StandardSQLFunction( "pad", StandardBasicTypes.STRING ) );
registerFunction( "position", new StandardSQLFunction( "position", StandardBasicTypes.LONG ) );
registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.DOUBLE ) );
registerFunction( "random", new NoArgSQLFunction( "random", StandardBasicTypes.LONG, true ) );
registerFunction( "randomf", new NoArgSQLFunction( "randomf", StandardBasicTypes.DOUBLE, true ) );
registerFunction( "right", new StandardSQLFunction( "right", StandardBasicTypes.STRING ) );
registerFunction( "session_user", new NoArgSQLFunction( "session_user", StandardBasicTypes.STRING, false ) );
registerFunction( "second", new StandardSQLFunction( "second", StandardBasicTypes.INTEGER ) );
registerFunction( "size", new NoArgSQLFunction( "size", StandardBasicTypes.LONG, true ) );
registerFunction( "squeeze", new StandardSQLFunction( "squeeze" ) );
registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
registerFunction( "system_user", new NoArgSQLFunction( "system_user", Hibernate.STRING, false ) );
//registerFunction( "trim", new StandardSQLFunction( "trim", Hibernate.STRING ) );
registerFunction( "unhex", new StandardSQLFunction( "unhex", Hibernate.STRING ) );
registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE ) );
registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1 FROM ?2 FOR ?3)" ) );
registerFunction( "system_user", new NoArgSQLFunction( "system_user", StandardBasicTypes.STRING, false ) );
//registerFunction( "trim", new StandardSQLFunction( "trim", StandardBasicTypes.STRING ) );
registerFunction( "unhex", new StandardSQLFunction( "unhex", StandardBasicTypes.STRING ) );
registerFunction( "upper", new StandardSQLFunction( "upper" ) );
registerFunction( "uppercase", new StandardSQLFunction( "uppercase" ) );
registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING, false ) );
registerFunction( "usercode", new NoArgSQLFunction( "usercode", Hibernate.STRING, true ) );
registerFunction( "username", new NoArgSQLFunction( "username", Hibernate.STRING, true ) );
registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", Hibernate.BYTE ) );
registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", Hibernate.INTEGER ) );
registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", Hibernate.BYTE ) );
registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", Hibernate.STRING ) );
registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING, false ) );
registerFunction( "usercode", new NoArgSQLFunction( "usercode", StandardBasicTypes.STRING, true ) );
registerFunction( "username", new NoArgSQLFunction( "username", StandardBasicTypes.STRING, true ) );
registerFunction( "uuid_create", new StandardSQLFunction( "uuid_create", StandardBasicTypes.BYTE ) );
registerFunction( "uuid_compare", new StandardSQLFunction( "uuid_compare", StandardBasicTypes.INTEGER ) );
registerFunction( "uuid_from_char", new StandardSQLFunction( "uuid_from_char", StandardBasicTypes.BYTE ) );
registerFunction( "uuid_to_char", new StandardSQLFunction( "uuid_to_char", StandardBasicTypes.STRING ) );
registerFunction( "year", new StandardSQLFunction( "year", StandardBasicTypes.INTEGER ) );
// Casting to char of numeric values introduces space padding up to the
// maximum width of a value for that return type. Casting to varchar
// does not introduce space padding.
registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as varchar)") );
registerFunction( "str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as varchar)") );
// Ingres driver supports getGeneratedKeys but only in the following
// form:
// The Ingres DBMS returns only a single table key or a single object

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,18 +20,18 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect for Interbase.
*
* @author Gavin King
*/
public class InterbaseDialect extends Dialect {
@ -55,7 +55,7 @@ public class InterbaseDialect extends Dialect {
registerColumnType( Types.BLOB, "blob" );
registerColumnType( Types.CLOB, "blob sub_type 1" );
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(","||",")" ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(","||",")" ) );
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
}

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,13 +20,11 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.cfg.Environment;
@ -34,10 +32,13 @@ import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.lock.*;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.MckoiCaseFragment;
import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect compatible with McKoi SQL
* @author Doug Currie, Gabe Hicks
*
* @author Doug Currie
* @author Gabe Hicks
*/
public class MckoiDialect extends Dialect {
public MckoiDialect() {
@ -61,15 +62,15 @@ public class MckoiDialect extends Dialect {
registerFunction( "upper", new StandardSQLFunction("upper") );
registerFunction( "lower", new StandardSQLFunction("lower") );
registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
registerFunction( "sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
registerFunction( "abs", new StandardSQLFunction("abs") );
registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
registerFunction( "round", new StandardSQLFunction( "round", Hibernate.INTEGER ) );
registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );
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", Hibernate.STRING ) );
registerFunction( "concat", new StandardSQLFunction( "concat", Hibernate.STRING ) );
registerFunction( "user", new StandardSQLFunction( "user", StandardBasicTypes.STRING ) );
registerFunction( "concat", new StandardSQLFunction( "concat", StandardBasicTypes.STRING ) );
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
}

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,15 +20,14 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.*;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* An Hibernate 3 SQL dialect for Mimer SQL. This dialect requires Mimer SQL 9.2.1 or later
@ -73,66 +72,66 @@ public class MimerSQLDialect extends Dialect {
registerColumnType( Types.CLOB, "NCLOB($l)" );
registerFunction("abs", new StandardSQLFunction("abs") );
registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
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", Hibernate.DOUBLE) );
registerFunction("acos", new StandardSQLFunction("dacos", Hibernate.DOUBLE) );
registerFunction("dasin", new StandardSQLFunction("dasin", Hibernate.DOUBLE) );
registerFunction("asin", new StandardSQLFunction("dasin", Hibernate.DOUBLE) );
registerFunction("datan", new StandardSQLFunction("datan", Hibernate.DOUBLE) );
registerFunction("atan", new StandardSQLFunction("datan", Hibernate.DOUBLE) );
registerFunction("datan2", new StandardSQLFunction("datan2", Hibernate.DOUBLE) );
registerFunction("atan2", new StandardSQLFunction("datan2", Hibernate.DOUBLE) );
registerFunction("dcos", new StandardSQLFunction("dcos", Hibernate.DOUBLE) );
registerFunction("cos", new StandardSQLFunction("dcos", Hibernate.DOUBLE) );
registerFunction("dcot", new StandardSQLFunction("dcot", Hibernate.DOUBLE) );
registerFunction("cot", new StandardSQLFunction("dcot", Hibernate.DOUBLE) );
registerFunction("ddegrees", new StandardSQLFunction("ddegrees", Hibernate.DOUBLE) );
registerFunction("degrees", new StandardSQLFunction("ddegrees", Hibernate.DOUBLE) );
registerFunction("dexp", new StandardSQLFunction("dexp", Hibernate.DOUBLE) );
registerFunction("exp", new StandardSQLFunction("dexp", Hibernate.DOUBLE) );
registerFunction("dlog", new StandardSQLFunction("dlog", Hibernate.DOUBLE) );
registerFunction("log", new StandardSQLFunction("dlog", Hibernate.DOUBLE) );
registerFunction("dlog10", new StandardSQLFunction("dlog10", Hibernate.DOUBLE) );
registerFunction("log10", new StandardSQLFunction("dlog10", Hibernate.DOUBLE) );
registerFunction("dradian", new StandardSQLFunction("dradian", Hibernate.DOUBLE) );
registerFunction("radian", new StandardSQLFunction("dradian", Hibernate.DOUBLE) );
registerFunction("dsin", new StandardSQLFunction("dsin", Hibernate.DOUBLE) );
registerFunction("sin", new StandardSQLFunction("dsin", Hibernate.DOUBLE) );
registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
registerFunction("dsqrt", new StandardSQLFunction("dsqrt", Hibernate.DOUBLE) );
registerFunction("sqrt", new StandardSQLFunction("dsqrt", Hibernate.DOUBLE) );
registerFunction("dtan", new StandardSQLFunction("dtan", Hibernate.DOUBLE) );
registerFunction("tan", new StandardSQLFunction("dtan", Hibernate.DOUBLE) );
registerFunction("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", Hibernate.DATE) );
registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
registerFunction("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", Hibernate.STRING) );
registerFunction("real", new StandardSQLFunction("real", Hibernate.FLOAT) );
registerFunction("bigint", new StandardSQLFunction("bigint", Hibernate.LONG) );
registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
registerFunction("integer", new StandardSQLFunction("integer", Hibernate.INTEGER) );
registerFunction("smallint", new StandardSQLFunction("smallint", Hibernate.SHORT) );
registerFunction("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", Hibernate.CHARACTER) );
registerFunction("ascii_code", new StandardSQLFunction("ascii_code", Hibernate.STRING));
registerFunction("unicode_char", new StandardSQLFunction("unicode_char", Hibernate.LONG));
registerFunction("unicode_code", new StandardSQLFunction("unicode_code", Hibernate.STRING));
registerFunction("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", Hibernate.LONG) );
registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.STRING));
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");

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -29,11 +28,10 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.LockOptions;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.StringHelper;
/**
@ -71,108 +69,108 @@ public class MySQLDialect extends Dialect {
// registerColumnType( Types.CLOB, 65535, "text" );
registerVarcharTypes();
registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
registerFunction("bin", new StandardSQLFunction("bin", Hibernate.STRING) );
registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.LONG) );
registerFunction("character_length", new StandardSQLFunction("character_length", Hibernate.LONG) );
registerFunction("ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
registerFunction("bin", new StandardSQLFunction("bin", StandardBasicTypes.STRING) );
registerFunction("char_length", new StandardSQLFunction("char_length", StandardBasicTypes.LONG) );
registerFunction("character_length", new StandardSQLFunction("character_length", StandardBasicTypes.LONG) );
registerFunction("lcase", new StandardSQLFunction("lcase") );
registerFunction("lower", new StandardSQLFunction("lower") );
registerFunction("ltrim", new StandardSQLFunction("ltrim") );
registerFunction("ord", new StandardSQLFunction("ord", Hibernate.INTEGER) );
registerFunction("ord", new StandardSQLFunction("ord", StandardBasicTypes.INTEGER) );
registerFunction("quote", new StandardSQLFunction("quote") );
registerFunction("reverse", new StandardSQLFunction("reverse") );
registerFunction("rtrim", new StandardSQLFunction("rtrim") );
registerFunction("soundex", new StandardSQLFunction("soundex") );
registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING) );
registerFunction("space", new StandardSQLFunction("space", StandardBasicTypes.STRING) );
registerFunction("ucase", new StandardSQLFunction("ucase") );
registerFunction("upper", new StandardSQLFunction("upper") );
registerFunction("unhex", new StandardSQLFunction("unhex", Hibernate.STRING) );
registerFunction("unhex", new StandardSQLFunction("unhex", StandardBasicTypes.STRING) );
registerFunction("abs", new StandardSQLFunction("abs") );
registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
registerFunction("sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
registerFunction("crc32", new StandardSQLFunction("crc32", Hibernate.LONG) );
registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
registerFunction("log2", new StandardSQLFunction("log2", Hibernate.DOUBLE) );
registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
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("crc32", new StandardSQLFunction("crc32", StandardBasicTypes.LONG) );
registerFunction("exp", new StandardSQLFunction("exp", StandardBasicTypes.DOUBLE) );
registerFunction("ln", new StandardSQLFunction("ln", StandardBasicTypes.DOUBLE) );
registerFunction("log", new StandardSQLFunction("log", StandardBasicTypes.DOUBLE) );
registerFunction("log2", new StandardSQLFunction("log2", StandardBasicTypes.DOUBLE) );
registerFunction("log10", new StandardSQLFunction("log10", StandardBasicTypes.DOUBLE) );
registerFunction("pi", new NoArgSQLFunction("pi", StandardBasicTypes.DOUBLE) );
registerFunction("rand", new NoArgSQLFunction("rand", StandardBasicTypes.DOUBLE) );
registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
registerFunction("radians", new StandardSQLFunction("radians", StandardBasicTypes.DOUBLE) );
registerFunction("degrees", new StandardSQLFunction("degrees", StandardBasicTypes.DOUBLE) );
registerFunction("ceiling", new StandardSQLFunction("ceiling", Hibernate.INTEGER) );
registerFunction("ceil", new StandardSQLFunction("ceil", Hibernate.INTEGER) );
registerFunction("floor", new StandardSQLFunction("floor", Hibernate.INTEGER) );
registerFunction("ceiling", new StandardSQLFunction("ceiling", StandardBasicTypes.INTEGER) );
registerFunction("ceil", new StandardSQLFunction("ceil", StandardBasicTypes.INTEGER) );
registerFunction("floor", new StandardSQLFunction("floor", StandardBasicTypes.INTEGER) );
registerFunction("round", new StandardSQLFunction("round") );
registerFunction("datediff", new StandardSQLFunction("datediff", Hibernate.INTEGER) );
registerFunction("timediff", new StandardSQLFunction("timediff", Hibernate.TIME) );
registerFunction("date_format", new StandardSQLFunction("date_format", Hibernate.STRING) );
registerFunction("datediff", new StandardSQLFunction("datediff", StandardBasicTypes.INTEGER) );
registerFunction("timediff", new StandardSQLFunction("timediff", StandardBasicTypes.TIME) );
registerFunction("date_format", new StandardSQLFunction("date_format", StandardBasicTypes.STRING) );
registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE) );
registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME) );
registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME, false) );
registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
registerFunction("from_days", new StandardSQLFunction("from_days", Hibernate.DATE) );
registerFunction("from_unixtime", new StandardSQLFunction("from_unixtime", Hibernate.TIMESTAMP) );
registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
registerFunction("last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
registerFunction("localtime", new NoArgSQLFunction("localtime", Hibernate.TIMESTAMP) );
registerFunction("localtimestamp", new NoArgSQLFunction("localtimestamp", Hibernate.TIMESTAMP) );
registerFunction("microseconds", new StandardSQLFunction("microseconds", Hibernate.INTEGER) );
registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP) );
registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
registerFunction("sec_to_time", new StandardSQLFunction("sec_to_time", Hibernate.TIME) );
registerFunction("sysdate", new NoArgSQLFunction("sysdate", Hibernate.TIMESTAMP) );
registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
registerFunction("time_to_sec", new StandardSQLFunction("time_to_sec", Hibernate.INTEGER) );
registerFunction("to_days", new StandardSQLFunction("to_days", Hibernate.LONG) );
registerFunction("unix_timestamp", new StandardSQLFunction("unix_timestamp", Hibernate.LONG) );
registerFunction("utc_date", new NoArgSQLFunction("utc_date", Hibernate.STRING) );
registerFunction("utc_time", new NoArgSQLFunction("utc_time", Hibernate.STRING) );
registerFunction("utc_timestamp", new NoArgSQLFunction("utc_timestamp", Hibernate.STRING) );
registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
registerFunction("weekday", new StandardSQLFunction("weekday", Hibernate.INTEGER) );
registerFunction("weekofyear", new StandardSQLFunction("weekofyear", Hibernate.INTEGER) );
registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );
registerFunction("yearweek", new StandardSQLFunction("yearweek", Hibernate.INTEGER) );
registerFunction("curdate", new NoArgSQLFunction("curdate", StandardBasicTypes.DATE) );
registerFunction("curtime", new NoArgSQLFunction("curtime", StandardBasicTypes.TIME) );
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", new StandardSQLFunction("date", StandardBasicTypes.DATE) );
registerFunction("day", new StandardSQLFunction("day", StandardBasicTypes.INTEGER) );
registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", StandardBasicTypes.INTEGER) );
registerFunction("dayname", new StandardSQLFunction("dayname", StandardBasicTypes.STRING) );
registerFunction("dayofweek", new StandardSQLFunction("dayofweek", StandardBasicTypes.INTEGER) );
registerFunction("dayofyear", new StandardSQLFunction("dayofyear", StandardBasicTypes.INTEGER) );
registerFunction("from_days", new StandardSQLFunction("from_days", StandardBasicTypes.DATE) );
registerFunction("from_unixtime", new StandardSQLFunction("from_unixtime", StandardBasicTypes.TIMESTAMP) );
registerFunction("hour", new StandardSQLFunction("hour", StandardBasicTypes.INTEGER) );
registerFunction("last_day", new StandardSQLFunction("last_day", StandardBasicTypes.DATE) );
registerFunction("localtime", new NoArgSQLFunction("localtime", StandardBasicTypes.TIMESTAMP) );
registerFunction("localtimestamp", new NoArgSQLFunction("localtimestamp", StandardBasicTypes.TIMESTAMP) );
registerFunction("microseconds", new StandardSQLFunction("microseconds", StandardBasicTypes.INTEGER) );
registerFunction("minute", new StandardSQLFunction("minute", StandardBasicTypes.INTEGER) );
registerFunction("month", new StandardSQLFunction("month", StandardBasicTypes.INTEGER) );
registerFunction("monthname", new StandardSQLFunction("monthname", StandardBasicTypes.STRING) );
registerFunction("now", new NoArgSQLFunction("now", StandardBasicTypes.TIMESTAMP) );
registerFunction("quarter", new StandardSQLFunction("quarter", StandardBasicTypes.INTEGER) );
registerFunction("second", new StandardSQLFunction("second", StandardBasicTypes.INTEGER) );
registerFunction("sec_to_time", new StandardSQLFunction("sec_to_time", StandardBasicTypes.TIME) );
registerFunction("sysdate", new NoArgSQLFunction("sysdate", StandardBasicTypes.TIMESTAMP) );
registerFunction("time", new StandardSQLFunction("time", StandardBasicTypes.TIME) );
registerFunction("timestamp", new StandardSQLFunction("timestamp", StandardBasicTypes.TIMESTAMP) );
registerFunction("time_to_sec", new StandardSQLFunction("time_to_sec", StandardBasicTypes.INTEGER) );
registerFunction("to_days", new StandardSQLFunction("to_days", StandardBasicTypes.LONG) );
registerFunction("unix_timestamp", new StandardSQLFunction("unix_timestamp", StandardBasicTypes.LONG) );
registerFunction("utc_date", new NoArgSQLFunction("utc_date", StandardBasicTypes.STRING) );
registerFunction("utc_time", new NoArgSQLFunction("utc_time", StandardBasicTypes.STRING) );
registerFunction("utc_timestamp", new NoArgSQLFunction("utc_timestamp", StandardBasicTypes.STRING) );
registerFunction("week", new StandardSQLFunction("week", StandardBasicTypes.INTEGER) );
registerFunction("weekday", new StandardSQLFunction("weekday", StandardBasicTypes.INTEGER) );
registerFunction("weekofyear", new StandardSQLFunction("weekofyear", StandardBasicTypes.INTEGER) );
registerFunction("year", new StandardSQLFunction("year", StandardBasicTypes.INTEGER) );
registerFunction("yearweek", new StandardSQLFunction("yearweek", StandardBasicTypes.INTEGER) );
registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
registerFunction("oct", new StandardSQLFunction("oct", Hibernate.STRING) );
registerFunction("hex", new StandardSQLFunction("hex", StandardBasicTypes.STRING) );
registerFunction("oct", new StandardSQLFunction("oct", StandardBasicTypes.STRING) );
registerFunction("octet_length", new StandardSQLFunction("octet_length", Hibernate.LONG) );
registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.LONG) );
registerFunction("octet_length", new StandardSQLFunction("octet_length", StandardBasicTypes.LONG) );
registerFunction("bit_length", new StandardSQLFunction("bit_length", StandardBasicTypes.LONG) );
registerFunction("bit_count", new StandardSQLFunction("bit_count", Hibernate.LONG) );
registerFunction("encrypt", new StandardSQLFunction("encrypt", Hibernate.STRING) );
registerFunction("md5", new StandardSQLFunction("md5", Hibernate.STRING) );
registerFunction("sha1", new StandardSQLFunction("sha1", Hibernate.STRING) );
registerFunction("sha", new StandardSQLFunction("sha", Hibernate.STRING) );
registerFunction("bit_count", new StandardSQLFunction("bit_count", StandardBasicTypes.LONG) );
registerFunction("encrypt", new StandardSQLFunction("encrypt", StandardBasicTypes.STRING) );
registerFunction("md5", new StandardSQLFunction("md5", StandardBasicTypes.STRING) );
registerFunction("sha1", new StandardSQLFunction("sha1", StandardBasicTypes.STRING) );
registerFunction("sha", new StandardSQLFunction("sha", StandardBasicTypes.STRING) );
registerFunction( "concat", new StandardSQLFunction( "concat", Hibernate.STRING ) );
registerFunction( "concat", new StandardSQLFunction( "concat", StandardBasicTypes.STRING ) );
getDefaultProperties().setProperty(Environment.MAX_FETCH_DEPTH, "2");
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -39,8 +38,8 @@ import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.NvlFunction;
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
@ -108,83 +107,83 @@ public class Oracle8iDialect extends Dialect {
protected void registerFunctions() {
registerFunction( "abs", new StandardSQLFunction("abs") );
registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );
registerFunction( "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( "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", Hibernate.CHARACTER) );
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", Hibernate.INTEGER) );
registerFunction( "ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.TIMESTAMP) );
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", Hibernate.DATE, false) );
registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", Hibernate.TIME, false) );
registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
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", Hibernate.DATE) );
registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.DATE, false) );
registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", Hibernate.TIMESTAMP, false) );
registerFunction( "uid", new NoArgSQLFunction("uid", Hibernate.INTEGER, false) );
registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );
registerFunction( "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", Hibernate.LONG, false) );
registerFunction( "rownum", new NoArgSQLFunction("rownum", Hibernate.LONG, 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(Hibernate.STRING, "", "||", "") );
registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.INTEGER) );
registerFunction( "instrb", new StandardSQLFunction("instrb", Hibernate.INTEGER) );
registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
registerFunction( "substrb", new StandardSQLFunction("substrb", Hibernate.STRING) );
registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );
registerFunction( "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", Hibernate.STRING ) );
registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "instr(?2,?1)" ) );
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "vsize(?1)*8" ) );
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", Hibernate.FLOAT) );
registerFunction( "log", new StandardSQLFunction("log", Hibernate.INTEGER) );
registerFunction( "mod", new StandardSQLFunction("mod", Hibernate.INTEGER) );
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", Hibernate.FLOAT) );
registerFunction( "power", new StandardSQLFunction("power", StandardBasicTypes.FLOAT) );
// Multi-param date dialect functions...
registerFunction( "add_months", new StandardSQLFunction("add_months", Hibernate.DATE) );
registerFunction( "months_between", new StandardSQLFunction("months_between", Hibernate.FLOAT) );
registerFunction( "next_day", new StandardSQLFunction("next_day", Hibernate.DATE) );
registerFunction( "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", Hibernate.STRING) );
registerFunction( "str", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
}
protected void registerDefaultProperties() {

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -32,7 +31,7 @@ import java.sql.Types;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
@ -43,6 +42,7 @@ import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
import org.hibernate.exception.ViolatedConstraintNameExtracter;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.ReflectHelper;
/**
@ -87,83 +87,83 @@ public class Oracle9Dialect extends Dialect {
getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
registerFunction( "abs", new StandardSQLFunction("abs") );
registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction( "acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
registerFunction( "stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
registerFunction( "sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
registerFunction( "variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );
registerFunction( "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( "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", Hibernate.CHARACTER) );
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", Hibernate.INTEGER) );
registerFunction( "ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
registerFunction( "to_char", new StandardSQLFunction("to_char", Hibernate.STRING) );
registerFunction( "to_date", new StandardSQLFunction("to_date", Hibernate.TIMESTAMP) );
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", Hibernate.DATE, false) );
registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", Hibernate.TIME, false) );
registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
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", Hibernate.DATE) );
registerFunction( "sysdate", new NoArgSQLFunction("sysdate", Hibernate.DATE, false) );
registerFunction( "systimestamp", new NoArgSQLFunction("systimestamp", Hibernate.TIMESTAMP, false) );
registerFunction( "uid", new NoArgSQLFunction("uid", Hibernate.INTEGER, false) );
registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );
registerFunction( "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", Hibernate.LONG, false) );
registerFunction( "rownum", new NoArgSQLFunction("rownum", Hibernate.LONG, 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(Hibernate.STRING, "", "||", "") );
registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.INTEGER) );
registerFunction( "instrb", new StandardSQLFunction("instrb", Hibernate.INTEGER) );
registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
registerFunction( "substrb", new StandardSQLFunction("substrb", Hibernate.STRING) );
registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );
registerFunction( "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", Hibernate.STRING ) );
registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "instr(?2,?1)" ) );
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "vsize(?1)*8" ) );
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", Hibernate.FLOAT) );
registerFunction( "log", new StandardSQLFunction("log", Hibernate.INTEGER) );
registerFunction( "mod", new StandardSQLFunction("mod", Hibernate.INTEGER) );
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", Hibernate.FLOAT) );
registerFunction( "power", new StandardSQLFunction("power", StandardBasicTypes.FLOAT) );
// Multi-param date dialect functions...
registerFunction( "add_months", new StandardSQLFunction("add_months", Hibernate.DATE) );
registerFunction( "months_between", new StandardSQLFunction("months_between", Hibernate.FLOAT) );
registerFunction( "next_day", new StandardSQLFunction("next_day", Hibernate.DATE) );
registerFunction( "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", Hibernate.STRING) );
registerFunction( "str", new StandardSQLFunction("to_char", StandardBasicTypes.STRING) );
}
public String getAddColumnString() {

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -33,7 +32,7 @@ import org.hibernate.sql.ANSICaseFragment;
/**
* A dialect for Oracle 9i databases.
* <p/>
* Unlike the older (deprecated) {@Link Oracl9Dialect), this version specifies
* Unlike the older (deprecated) {@link Oracle9Dialect), this version specifies
* to not use "ANSI join syntax" because 9i does not seem to properly
* handle it in all cases.
*

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -29,10 +28,10 @@ import java.sql.SQLException;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import org.hibernate.Hibernate;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.NvlFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect for Postgres Plus
@ -47,24 +46,24 @@ public class PostgresPlusDialect extends PostgreSQLDialect {
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
registerFunction( "soundex", new StandardSQLFunction( "soundex" ) );
registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.DATE, false ) );
registerFunction( "rowid", new NoArgSQLFunction( "rowid", Hibernate.LONG, false ) );
registerFunction( "rownum", new NoArgSQLFunction( "rownum", Hibernate.LONG, false ) );
registerFunction( "instr", new StandardSQLFunction( "instr", Hibernate.INTEGER ) );
registerFunction( "lpad", new StandardSQLFunction( "lpad", Hibernate.STRING ) );
registerFunction( "replace", new StandardSQLFunction( "replace", Hibernate.STRING ) );
registerFunction( "rpad", new StandardSQLFunction( "rpad", Hibernate.STRING ) );
registerFunction( "translate", new StandardSQLFunction( "translate", Hibernate.STRING ) );
registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
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", Hibernate.FLOAT ) );
registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );
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", Hibernate.FLOAT ) );
registerFunction( "add_months", new StandardSQLFunction( "add_months", Hibernate.DATE ) );
registerFunction( "months_between", new StandardSQLFunction( "months_between", Hibernate.FLOAT ) );
registerFunction( "next_day", new StandardSQLFunction( "next_day", Hibernate.DATE ) );
registerFunction( "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 ) );
}
public String getCurrentTimestampSelectString() {

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -73,10 +72,3 @@ public class ProgressDialect extends Dialect {
return false;
}
}

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -35,6 +34,8 @@ import org.hibernate.LockMode;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.DecodeCaseFragment;
import org.hibernate.type.StandardBasicTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -68,19 +69,19 @@ public class RDMSOS2200Dialect extends Dialect {
* string is provided, plus an optional hasParenthesesIfNoArgs flag.
*/
registerFunction( "abs", new StandardSQLFunction("abs") );
registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER) );
registerFunction("char_length", new StandardSQLFunction("char_length", Hibernate.INTEGER) );
registerFunction("character_length", new StandardSQLFunction("character_length", Hibernate.INTEGER) );
registerFunction("ascii", new StandardSQLFunction("ascii", StandardBasicTypes.INTEGER) );
registerFunction("char_length", new StandardSQLFunction("char_length", StandardBasicTypes.INTEGER) );
registerFunction("character_length", new StandardSQLFunction("character_length", StandardBasicTypes.INTEGER) );
// The RDMS concat() function only supports 2 parameters
registerFunction( "concat", new SQLFunctionTemplate(Hibernate.STRING, "concat(?1, ?2)") );
registerFunction( "instr", new StandardSQLFunction("instr", Hibernate.STRING) );
registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
registerFunction( "replace", new StandardSQLFunction("replace", Hibernate.STRING) );
registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
registerFunction( "concat", new SQLFunctionTemplate(StandardBasicTypes.STRING, "concat(?1, ?2)") );
registerFunction( "instr", new StandardSQLFunction("instr", StandardBasicTypes.STRING) );
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("lcase", new StandardSQLFunction("lcase") );
registerFunction("lower", new StandardSQLFunction("lower") );
@ -89,68 +90,68 @@ public class RDMSOS2200Dialect extends Dialect {
registerFunction("rtrim", new StandardSQLFunction("rtrim") );
// RDMS does not directly support the trim() function, we use rtrim() and ltrim()
registerFunction("trim", new SQLFunctionTemplate(Hibernate.INTEGER, "ltrim(rtrim(?1))" ) );
registerFunction("trim", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "ltrim(rtrim(?1))" ) );
registerFunction("soundex", new StandardSQLFunction("soundex") );
registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING) );
registerFunction("space", new StandardSQLFunction("space", StandardBasicTypes.STRING) );
registerFunction("ucase", new StandardSQLFunction("ucase") );
registerFunction("upper", new StandardSQLFunction("upper") );
registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
registerFunction("cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
registerFunction("sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
registerFunction("tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
registerFunction("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("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("log10", new StandardSQLFunction("log10", StandardBasicTypes.DOUBLE) );
registerFunction("pi", new NoArgSQLFunction("pi", StandardBasicTypes.DOUBLE) );
registerFunction("rand", new NoArgSQLFunction("rand", StandardBasicTypes.DOUBLE) );
registerFunction("sin", new StandardSQLFunction("sin", StandardBasicTypes.DOUBLE) );
registerFunction("sinh", new StandardSQLFunction("sinh", StandardBasicTypes.DOUBLE) );
registerFunction("sqrt", new StandardSQLFunction("sqrt", StandardBasicTypes.DOUBLE) );
registerFunction("tan", new StandardSQLFunction("tan", StandardBasicTypes.DOUBLE) );
registerFunction("tanh", new StandardSQLFunction("tanh", 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", Hibernate.CHARACTER) );
registerFunction( "chr", new StandardSQLFunction("chr", StandardBasicTypes.CHARACTER) );
registerFunction( "initcap", new StandardSQLFunction("initcap") );
registerFunction( "user", new NoArgSQLFunction("user", Hibernate.STRING, false) );
registerFunction( "user", new NoArgSQLFunction("user", StandardBasicTypes.STRING, false) );
registerFunction( "current_date", new NoArgSQLFunction("current_date", Hibernate.DATE, false) );
registerFunction( "current_time", new NoArgSQLFunction("current_timestamp", Hibernate.TIME, false) );
registerFunction( "current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP, false) );
registerFunction("curdate", new NoArgSQLFunction("curdate",Hibernate.DATE) );
registerFunction("curtime", new NoArgSQLFunction("curtime",Hibernate.TIME) );
registerFunction("days", new StandardSQLFunction("days",Hibernate.INTEGER) );
registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth",Hibernate.INTEGER) );
registerFunction("dayname", new StandardSQLFunction("dayname",Hibernate.STRING) );
registerFunction("dayofweek", new StandardSQLFunction("dayofweek",Hibernate.INTEGER) );
registerFunction("dayofyear", new StandardSQLFunction("dayofyear",Hibernate.INTEGER) );
registerFunction("hour", new StandardSQLFunction("hour",Hibernate.INTEGER) );
registerFunction("last_day", new StandardSQLFunction("last_day",Hibernate.DATE) );
registerFunction("microsecond", new StandardSQLFunction("microsecond",Hibernate.INTEGER) );
registerFunction("minute", new StandardSQLFunction("minute",Hibernate.INTEGER) );
registerFunction("month", new StandardSQLFunction("month",Hibernate.INTEGER) );
registerFunction("monthname", new StandardSQLFunction("monthname",Hibernate.STRING) );
registerFunction("now", new NoArgSQLFunction("now",Hibernate.TIMESTAMP) );
registerFunction("quarter", new StandardSQLFunction("quarter",Hibernate.INTEGER) );
registerFunction("second", new StandardSQLFunction("second",Hibernate.INTEGER) );
registerFunction("time", new StandardSQLFunction("time",Hibernate.TIME) );
registerFunction("timestamp", new StandardSQLFunction("timestamp",Hibernate.TIMESTAMP) );
registerFunction("week", new StandardSQLFunction("week",Hibernate.INTEGER) );
registerFunction("year", new StandardSQLFunction("year",Hibernate.INTEGER) );
registerFunction( "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("curdate", new NoArgSQLFunction("curdate",StandardBasicTypes.DATE) );
registerFunction("curtime", new NoArgSQLFunction("curtime",StandardBasicTypes.TIME) );
registerFunction("days", new StandardSQLFunction("days",StandardBasicTypes.INTEGER) );
registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth",StandardBasicTypes.INTEGER) );
registerFunction("dayname", new StandardSQLFunction("dayname",StandardBasicTypes.STRING) );
registerFunction("dayofweek", new StandardSQLFunction("dayofweek",StandardBasicTypes.INTEGER) );
registerFunction("dayofyear", new StandardSQLFunction("dayofyear",StandardBasicTypes.INTEGER) );
registerFunction("hour", new StandardSQLFunction("hour",StandardBasicTypes.INTEGER) );
registerFunction("last_day", new StandardSQLFunction("last_day",StandardBasicTypes.DATE) );
registerFunction("microsecond", new StandardSQLFunction("microsecond",StandardBasicTypes.INTEGER) );
registerFunction("minute", new StandardSQLFunction("minute",StandardBasicTypes.INTEGER) );
registerFunction("month", new StandardSQLFunction("month",StandardBasicTypes.INTEGER) );
registerFunction("monthname", new StandardSQLFunction("monthname",StandardBasicTypes.STRING) );
registerFunction("now", new NoArgSQLFunction("now",StandardBasicTypes.TIMESTAMP) );
registerFunction("quarter", new StandardSQLFunction("quarter",StandardBasicTypes.INTEGER) );
registerFunction("second", new StandardSQLFunction("second",StandardBasicTypes.INTEGER) );
registerFunction("time", new StandardSQLFunction("time",StandardBasicTypes.TIME) );
registerFunction("timestamp", new StandardSQLFunction("timestamp",StandardBasicTypes.TIMESTAMP) );
registerFunction("week", new StandardSQLFunction("week",StandardBasicTypes.INTEGER) );
registerFunction("year", new StandardSQLFunction("year",StandardBasicTypes.INTEGER) );
registerFunction("atan2", new StandardSQLFunction("atan2",Hibernate.DOUBLE) );
registerFunction( "mod", new StandardSQLFunction("mod",Hibernate.INTEGER) );
registerFunction("atan2", new StandardSQLFunction("atan2",StandardBasicTypes.DOUBLE) );
registerFunction( "mod", new StandardSQLFunction("mod",StandardBasicTypes.INTEGER) );
registerFunction( "nvl", new StandardSQLFunction("nvl") );
registerFunction( "power", new StandardSQLFunction("power", Hibernate.DOUBLE) );
registerFunction( "power", new StandardSQLFunction("power", StandardBasicTypes.DOUBLE) );
/**
* For a list of column types to register, see section A-1

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,13 +20,11 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
@ -34,8 +32,7 @@ import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.DecodeCaseFragment;
import org.hibernate.sql.OracleJoinFragment;
import org.hibernate.sql.JoinFragment;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.util.StringHelper;
/**
@ -64,26 +61,26 @@ public class SAPDBDialect extends Dialect {
registerColumnType( Types.BLOB, "long byte" );
registerFunction( "abs", new StandardSQLFunction("abs") );
registerFunction( "sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
registerFunction( "sign", new StandardSQLFunction("sign", StandardBasicTypes.INTEGER) );
registerFunction( "exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
registerFunction( "ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
registerFunction( "log", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
registerFunction( "pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE) );
registerFunction( "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", Hibernate.DOUBLE) );
registerFunction( "asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
registerFunction( "atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
registerFunction( "cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
registerFunction( "cosh", new StandardSQLFunction("cosh", Hibernate.DOUBLE) );
registerFunction( "cot", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
registerFunction( "sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
registerFunction( "sinh", new StandardSQLFunction("sinh", Hibernate.DOUBLE) );
registerFunction( "tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
registerFunction( "tanh", new StandardSQLFunction("tanh", Hibernate.DOUBLE) );
registerFunction( "radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
registerFunction( "degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
registerFunction( "atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE) );
registerFunction( "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") );
@ -92,48 +89,48 @@ public class SAPDBDialect extends Dialect {
registerFunction( "greatest", new StandardSQLFunction("greatest") );
registerFunction( "least", new StandardSQLFunction("least") );
registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) );
registerFunction("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(Hibernate.INTEGER, "second(?1)") );
registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "minute(?1)") );
registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "hour(?1)") );
registerFunction( "day", new SQLFunctionTemplate(Hibernate.INTEGER, "day(?1)") );
registerFunction( "month", new SQLFunctionTemplate(Hibernate.INTEGER, "month(?1)") );
registerFunction( "year", new SQLFunctionTemplate(Hibernate.INTEGER, "year(?1)") );
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(Hibernate.INTEGER, "?1(?3)") );
registerFunction( "extract", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1(?3)") );
registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER) );
registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
registerFunction("weekofyear", new StandardSQLFunction("weekofyear", Hibernate.INTEGER) );
registerFunction("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", Hibernate.STRING) );
registerFunction( "translate", new StandardSQLFunction("translate", Hibernate.STRING) );
registerFunction( "lpad", new StandardSQLFunction("lpad", Hibernate.STRING) );
registerFunction( "rpad", new StandardSQLFunction("rpad", Hibernate.STRING) );
registerFunction( "substr", new StandardSQLFunction("substr", Hibernate.STRING) );
registerFunction( "initcap", new StandardSQLFunction("initcap", Hibernate.STRING) );
registerFunction( "lower", new StandardSQLFunction("lower", Hibernate.STRING) );
registerFunction( "ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING) );
registerFunction( "rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING) );
registerFunction( "lfill", new StandardSQLFunction("ltrim", Hibernate.STRING) );
registerFunction( "rfill", new StandardSQLFunction("rtrim", Hibernate.STRING) );
registerFunction( "soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
registerFunction( "upper", new StandardSQLFunction("upper", Hibernate.STRING) );
registerFunction( "ascii", new StandardSQLFunction("ascii", Hibernate.STRING) );
registerFunction( "index", new StandardSQLFunction("index", Hibernate.INTEGER) );
registerFunction( "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( Hibernate.STRING, "(", "||", ")" ) );
registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
registerFunction( "locate", new StandardSQLFunction("index", Hibernate.INTEGER) );
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);

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,17 +20,16 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* A dialect for Microsoft SQL Server 2000 and 2005
@ -45,14 +44,14 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
registerColumnType( Types.LONGVARBINARY, "image" );
registerColumnType( Types.LONGVARCHAR, "text" );
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( "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( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "datalength(?1) * 8" ) );
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() );

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by
* third-party contributors as indicated by either @author tags or express
* copyright attribution statements applied by the authors. All
* third-party contributions are distributed under license by Red Hat Inc.
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -25,9 +25,9 @@ package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.type.StandardBasicTypes;
/**
* An SQL dialect targetting Sybase Adaptive Server Enterprise (ASE) 15 and higher.
@ -43,12 +43,12 @@ public class SybaseASE15Dialect extends AbstractTransactSQLDialect {
registerColumnType( Types.LONGVARBINARY, "image" );
registerColumnType( Types.LONGVARCHAR, "text" );
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( "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( "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( "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( AnsiTrimEmulationFunction.LTRIM, AnsiTrimEmulationFunction.RTRIM, "str_replace" ) );
}

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by
* third-party contributors as indicated by either @author tags or express
* copyright attribution statements applied by the authors. All
* third-party contributions are distributed under license by Red Hat Inc.
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU

View File

@ -1,11 +1,10 @@
//$Id $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -21,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
@ -32,10 +30,10 @@ package org.hibernate.dialect;
* {@link AbstractTransactSQLDialect} should be used as the base class for
* TransactSQL-based dialects.
*
* @deprecated use {@link AbstractTransactSQLDialect}, {@link SybaseASE15Dialect} or {@link SQLServerDialect}
* instead depending on need.
*
* @author Gail Badner
* @deprecated use {@link AbstractTransactSQLDialect},
* {@link SybaseASE15Dialect} or {@link SQLServerDialect} instead depending on
* need.
*/
public class SybaseDialect extends AbstractTransactSQLDialect {
}

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,17 +20,16 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* A dialect for the Teradata database created by MCR as part of the
@ -67,13 +66,13 @@ public class TeradataDialect extends Dialect {
registerColumnType( Types.BLOB, "BLOB" );
registerColumnType( Types.CLOB, "CLOB" );
registerFunction( "year", new SQLFunctionTemplate( Hibernate.INTEGER, "extract(year from ?1)" ) );
registerFunction( "length", new SQLFunctionTemplate( Hibernate.INTEGER, "character_length(?1)" ) );
registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1 from ?2 for ?3)" ) );
registerFunction( "locate", new SQLFunctionTemplate( Hibernate.STRING, "position(?1 in ?2)" ) );
registerFunction( "mod", new SQLFunctionTemplate( Hibernate.STRING, "?1 mod ?2" ) );
registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as varchar(255))" ) );
registerFunction( "year", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "extract(year from ?1)" ) );
registerFunction( "length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "character_length(?1)" ) );
registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1 from ?2 for ?3)" ) );
registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.STRING, "position(?1 in ?2)" ) );
registerFunction( "mod", new SQLFunctionTemplate( StandardBasicTypes.STRING, "?1 mod ?2" ) );
registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as varchar(255))" ) );
// bit_length feels a bit broken to me. We have to cast to char in order to
// pass when a numeric value is supplied. But of course the answers given will
@ -81,16 +80,16 @@ public class TeradataDialect extends Dialect {
// a char string but will be 8 or 16 bytes as a true numeric.
// Jay Nance 2006-09-22
registerFunction(
"bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "octet_length(cast(?1 as char))*4" )
"bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "octet_length(cast(?1 as char))*4" )
);
// The preference here would be
// SQLFunctionTemplate( Hibernate.TIMESTAMP, "current_timestamp(?1)", false)
// SQLFunctionTemplate( StandardBasicTypes.TIMESTAMP, "current_timestamp(?1)", false)
// but this appears not to work.
// Jay Nance 2006-09-22
registerFunction( "current_timestamp", new SQLFunctionTemplate( Hibernate.TIMESTAMP, "current_timestamp" ) );
registerFunction( "current_time", new SQLFunctionTemplate( Hibernate.TIMESTAMP, "current_time" ) );
registerFunction( "current_date", new SQLFunctionTemplate( Hibernate.TIMESTAMP, "current_date" ) );
registerFunction( "current_timestamp", new SQLFunctionTemplate( StandardBasicTypes.TIMESTAMP, "current_timestamp" ) );
registerFunction( "current_time", new SQLFunctionTemplate( StandardBasicTypes.TIMESTAMP, "current_time" ) );
registerFunction( "current_date", new SQLFunctionTemplate( StandardBasicTypes.TIMESTAMP, "current_date" ) );
// IBID for current_time and current_date
registerKeyword( "password" );

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,11 +20,10 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;
import org.hibernate.Hibernate;
import org.hibernate.type.StandardBasicTypes;
/**
* A {@link SQLFunction} implementation that emulates the ANSI SQL trim function
@ -162,43 +161,43 @@ public class AnsiTrimEmulationFunction extends AbstractAnsiTrimEmulationFunction
*/
public AnsiTrimEmulationFunction(String ltrimFunctionName, String rtrimFunctionName, String replaceFunctionName) {
leadingSpaceTrim = new SQLFunctionTemplate(
Hibernate.STRING,
StandardBasicTypes.STRING,
LEADING_SPACE_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
);
trailingSpaceTrim = new SQLFunctionTemplate(
Hibernate.STRING,
StandardBasicTypes.STRING,
TRAILING_SPACE_TRIM_TEMPLATE.replaceAll( RTRIM, rtrimFunctionName )
);
bothSpaceTrim = new SQLFunctionTemplate(
Hibernate.STRING,
StandardBasicTypes.STRING,
BOTH_SPACE_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
);
bothSpaceTrimFrom = new SQLFunctionTemplate(
Hibernate.STRING,
StandardBasicTypes.STRING,
BOTH_SPACE_TRIM_FROM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
);
leadingTrim = new SQLFunctionTemplate(
Hibernate.STRING,
StandardBasicTypes.STRING,
LEADING_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
.replaceAll( REPLACE,replaceFunctionName )
);
trailingTrim = new SQLFunctionTemplate(
Hibernate.STRING,
StandardBasicTypes.STRING,
TRAILING_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
.replaceAll( REPLACE,replaceFunctionName )
);
bothTrim = new SQLFunctionTemplate(
Hibernate.STRING,
StandardBasicTypes.STRING,
BOTH_TRIM_TEMPLATE.replaceAll( LTRIM, ltrimFunctionName )
.replaceAll( RTRIM, rtrimFunctionName )
.replaceAll( REPLACE,replaceFunctionName )

View File

@ -1,7 +1,7 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009, Red Hat Inc. or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,16 +20,15 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@ -46,7 +45,7 @@ public class CharIndexFunction implements SQLFunction {
}
public Type getReturnType(Type columnType, Mapping mapping) throws QueryException {
return Hibernate.INTEGER;
return StandardBasicTypes.INTEGER;
}
public String render(Type columnType, List args, SessionFactoryImplementor factory) throws QueryException {

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,16 +20,15 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.MappingException;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@ -54,7 +53,7 @@ public class ClassicAvgFunction extends StandardSQLFunction {
if ( sqlTypes.length != 1 ) throw new QueryException( "multi-column type in avg()" );
int sqlType = sqlTypes[0];
if ( sqlType == Types.INTEGER || sqlType == Types.BIGINT || sqlType == Types.TINYINT ) {
return Hibernate.FLOAT;
return StandardBasicTypes.FLOAT;
}
else {
return columnType;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,15 +20,13 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;
import org.hibernate.Hibernate;
import org.hibernate.engine.Mapping;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
* Classic COUNT sqlfunction that return types as it was done in Hibernate 3.1
*
@ -41,6 +39,6 @@ public class ClassicCountFunction extends StandardSQLFunction {
}
public Type getReturnType(Type columnType, Mapping mapping) {
return Hibernate.INTEGER;
return StandardBasicTypes.INTEGER;
}
}

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,11 +20,9 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;
/**
* Classic SUM sqlfunction that return types as it was done in Hibernate 3.1
*

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;

View File

@ -26,9 +26,9 @@ package org.hibernate.dialect.function;
import java.util.List;
import org.hibernate.QueryException;
import org.hibernate.Hibernate;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@ -47,7 +47,7 @@ public class ConvertFunction implements SQLFunction {
}
public Type getReturnType(Type firstArgumentType, Mapping mapping) throws QueryException {
return Hibernate.STRING;
return StandardBasicTypes.STRING;
}
public String render(Type firstArgumentType, List args, SessionFactoryImplementor factory) throws QueryException {

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;
@ -31,6 +30,7 @@ import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@ -72,7 +72,7 @@ public class DerbyConcatFunction implements SQLFunction {
* Here we always return {@link Hibernate#STRING}.
*/
public Type getReturnType(Type argumentType, Mapping mapping) throws QueryException {
return Hibernate.STRING;
return StandardBasicTypes.STRING;
}
/**

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;
@ -31,9 +30,9 @@ import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.type.Type;
/**
* A function which takes no arguments
*
* @author Michi
*/
public class NoArgSQLFunction implements SQLFunction {

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;

View File

@ -25,10 +25,10 @@ package org.hibernate.dialect.function;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@ -45,7 +45,7 @@ public class PositionSubstringFunction implements SQLFunction {
}
public Type getReturnType(Type firstArgumentType, Mapping mapping) throws QueryException {
return Hibernate.INTEGER;
return StandardBasicTypes.INTEGER;
}
public String render(Type firstArgumentType, List args, SessionFactoryImplementor factory) throws QueryException {

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;
@ -30,28 +29,28 @@ import java.util.Map;
import org.hibernate.dialect.Dialect;
public class SQLFunctionRegistry {
private final Dialect dialect;
private final Map userFunctions;
private final Map<String, SQLFunction> userFunctions;
public SQLFunctionRegistry(Dialect dialect, Map userFunctions) {
public SQLFunctionRegistry(Dialect dialect, Map<String, SQLFunction> userFunctions) {
this.dialect = dialect;
this.userFunctions = new HashMap();
this.userFunctions = new HashMap<String, SQLFunction>();
this.userFunctions.putAll( userFunctions );
}
public SQLFunction findSQLFunction(String functionName) {
// TODO: lower casing done here. Was done "at random" before; maybe not needed at all ?
String name = functionName.toLowerCase();
SQLFunction userFunction = (SQLFunction) userFunctions.get( name );
return userFunction!=null?userFunction:(SQLFunction) dialect.getFunctions().get(name); // TODO: lowercasing done here. Was done "at random" before; maybe not needed at all ?
SQLFunction userFunction = userFunctions.get( name );
return userFunction != null
? userFunction
: (SQLFunction) dialect.getFunctions().get( name );
}
public boolean hasFunction(String functionName) {
// TODO: toLowerCase was not done before. Only used in Template.
String name = functionName.toLowerCase();
boolean hasUserFunction = userFunctions.containsKey ( name );
return hasUserFunction || dialect.getFunctions().containsKey ( name ); // TODO: toLowerCase was not done before. Only used in Template.
return userFunctions.containsKey( name ) || dialect.getFunctions().containsKey( name );
}
}

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.function;

View File

@ -1,7 +1,7 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009, Red Hat Inc. or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
@ -25,10 +25,10 @@ package org.hibernate.dialect.function;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.engine.Mapping;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
/**
@ -46,7 +46,7 @@ public abstract class TrimFunctionTemplate implements SQLFunction {
}
public Type getReturnType(Type firstArgument, Mapping mapping) throws QueryException {
return Hibernate.STRING;
return StandardBasicTypes.STRING;
}
public String render(Type firstArgument, List args, SessionFactoryImplementor factory) throws QueryException {

View File

@ -1,10 +1,10 @@
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors. All third-party contributions are
~ distributed under license by Red Hat Middleware LLC.
~ distributed under license by Red Hat Inc.
~
~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
~
-->
<html>

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.lock;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.lock;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.lock;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.lock;

View File

@ -1,10 +1,10 @@
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
~ indicated by the @author tags or express copyright attribution
~ statements applied by the authors. All third-party contributions are
~ distributed under license by Red Hat Middleware LLC.
~ distributed under license by Red Hat Inc.
~
~ This copyrighted material is made available to anyone wishing to use, modify,
~ copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
~ Free Software Foundation, Inc.
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
~
-->
<html>

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.resolver;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.resolver;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.resolver;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.resolver;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.resolver;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.dialect.resolver;

View File

@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by
* third-party contributors as indicated by either @author tags or express
* copyright attribution statements applied by the authors. All
* third-party contributions are distributed under license by Red Hat Inc.
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU