HHH-3701 HHH-3640 : Add support for mod, bit_length, and trim to SybaseASE15Dialect
git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@15957 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
a088d6b9cb
commit
033feaac26
|
@ -11,6 +11,7 @@ import java.util.Iterator;
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
|
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
|
||||||
import org.hibernate.dialect.function.CharIndexFunction;
|
import org.hibernate.dialect.function.CharIndexFunction;
|
||||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||||
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
||||||
|
@ -29,6 +30,9 @@ public class SybaseASE15Dialect extends AbstractTransactSQLDialect {
|
||||||
registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(minute, ?1)") );
|
registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(minute, ?1)") );
|
||||||
registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(hour, ?1)") );
|
registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(hour, ?1)") );
|
||||||
registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
|
registerFunction( "extract", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(?1, ?3)" ) );
|
||||||
|
registerFunction( "mod", new SQLFunctionTemplate( Hibernate.INTEGER, "?1 % ?2" ) );
|
||||||
|
registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "datalength(?1) * 8" ) );
|
||||||
|
registerFunction( "trim", new AnsiTrimEmulationFunction( AnsiTrimEmulationFunction.LTRIM, AnsiTrimEmulationFunction.RTRIM, "str_replace" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.hibernate.test.criteria.CriteriaQueryTest;
|
||||||
import org.hibernate.test.cuk.CompositePropertyRefTest;
|
import org.hibernate.test.cuk.CompositePropertyRefTest;
|
||||||
import org.hibernate.test.cut.CompositeUserTypeTest;
|
import org.hibernate.test.cut.CompositeUserTypeTest;
|
||||||
import org.hibernate.test.deletetransient.DeleteTransientEntityTest;
|
import org.hibernate.test.deletetransient.DeleteTransientEntityTest;
|
||||||
|
import org.hibernate.test.dialect.function.AnsiTrimEmulationFunctionTest;
|
||||||
import org.hibernate.test.dialect.functional.cache.SQLFunctionsInterSystemsTest;
|
import org.hibernate.test.dialect.functional.cache.SQLFunctionsInterSystemsTest;
|
||||||
import org.hibernate.test.dialect.unit.lockhint.SQLServerLockHintsTest;
|
import org.hibernate.test.dialect.unit.lockhint.SQLServerLockHintsTest;
|
||||||
import org.hibernate.test.dialect.unit.lockhint.SybaseASE15LockHintsTest;
|
import org.hibernate.test.dialect.unit.lockhint.SybaseASE15LockHintsTest;
|
||||||
|
@ -500,6 +501,7 @@ public class AllTests {
|
||||||
suite.addTest( KeyManyToOneTest.suite() );
|
suite.addTest( KeyManyToOneTest.suite() );
|
||||||
suite.addTest( LazyKeyManyToOneTest.suite() );
|
suite.addTest( LazyKeyManyToOneTest.suite() );
|
||||||
suite.addTest( EagerKeyManyToOneTest.suite() );
|
suite.addTest( EagerKeyManyToOneTest.suite() );
|
||||||
|
suite.addTest( AnsiTrimEmulationFunctionTest.suite() );
|
||||||
suite.addTest( SQLFunctionsInterSystemsTest.suite() );
|
suite.addTest( SQLFunctionsInterSystemsTest.suite() );
|
||||||
suite.addTest( SybaseASE15LockHintsTest.suite() );
|
suite.addTest( SybaseASE15LockHintsTest.suite() );
|
||||||
suite.addTest( SybaseLockHintsTest.suite() );
|
suite.addTest( SybaseLockHintsTest.suite() );
|
||||||
|
|
|
@ -26,9 +26,11 @@ package org.hibernate.test.dialect.function;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
|
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
|
||||||
|
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
|
@ -38,6 +40,10 @@ import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
|
||||||
public class AnsiTrimEmulationFunctionTest extends TestCase {
|
public class AnsiTrimEmulationFunctionTest extends TestCase {
|
||||||
private static final String trimSource = "a.column";
|
private static final String trimSource = "a.column";
|
||||||
|
|
||||||
|
public static Test suite() {
|
||||||
|
return new FunctionalTestClassTestSuite( AnsiTrimEmulationFunctionTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
public void testBasicSqlServerProcessing() {
|
public void testBasicSqlServerProcessing() {
|
||||||
AnsiTrimEmulationFunction function = new AnsiTrimEmulationFunction();
|
AnsiTrimEmulationFunction function = new AnsiTrimEmulationFunction();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue