Author: gbadner
Date: 2008-12-19 19:37:02 -0500 (Fri, 19 Dec 2008)
New Revision: 15721
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java
Log:
HHH-3672 - Sybase - second(), minute(), hour(), and extract() cause GenericJDBCException
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2008-12-20
00:36:24 UTC (rev 15720)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2008-12-20
00:37:02 UTC (rev 15721)
@@ -43,12 +43,8 @@
registerColumnType( Types.VARBINARY, "image" );
registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
- registerFunction( "second", new SQLFunctionTemplate( Hibernate.INTEGER,
"datepart(second, ?1)" ) );
- registerFunction( "minute", new SQLFunctionTemplate( Hibernate.INTEGER,
"datepart(minute, ?1)" ) );
- registerFunction( "hour", new SQLFunctionTemplate( Hibernate.INTEGER,
"datepart(hour, ?1)" ) );
registerFunction( "locate", new StandardSQLFunction( "charindex",
Hibernate.INTEGER ) );
- registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER,
"datepart(?1, ?3)" ) );
registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1
% ?2" ) );
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER,
"datalength(?1) * 8" ) );
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java 2008-12-20
00:36:24 UTC (rev 15720)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/SybaseDialect.java 2008-12-20
00:37:02 UTC (rev 15721)
@@ -88,7 +88,11 @@
registerFunction( "month", new StandardSQLFunction("month",
Hibernate.INTEGER) );
registerFunction( "year", new StandardSQLFunction("year",
Hibernate.INTEGER) );
registerFunction( "datename", new StandardSQLFunction("datename",
Hibernate.STRING) );
-
+ 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( "abs", new StandardSQLFunction("abs") );
registerFunction( "sign", new StandardSQLFunction("sign",
Hibernate.INTEGER) );