HHH-3670 - Invalid test for str() for SQL Server and Sybase
git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@15711 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
957a58044c
commit
1e175bf5ee
|
@ -1191,13 +1191,18 @@ public class ASTParserLoadingTest extends FunctionalTestCase {
|
||||||
Animal an = new Animal();
|
Animal an = new Animal();
|
||||||
an.setBodyWeight(123.45f);
|
an.setBodyWeight(123.45f);
|
||||||
session.persist(an);
|
session.persist(an);
|
||||||
String str = (String) session.createQuery("select str(an.bodyWeight) from Animal an where str(an.bodyWeight) like '123%' or str(an.bodyWeight) like '1.23%'").uniqueResult();
|
String str = (String) session.createQuery("select str(an.bodyWeight) from Animal an where str(an.bodyWeight) like '%1%'").uniqueResult();
|
||||||
if ( getDialect() instanceof DB2Dialect ) {
|
if ( getDialect() instanceof DB2Dialect ) {
|
||||||
assertTrue( str.startsWith("1.234") );
|
assertTrue( str.startsWith("1.234") );
|
||||||
}
|
}
|
||||||
else if ( getDialect() instanceof SQLServerDialect ) {
|
else if ( getDialect() instanceof SybaseDialect ) {
|
||||||
// no assertion as SQLServer always returns nulls here; even trying directly against the
|
// str(val) on sybase assumes a default of 10 characters with no decimal point or decimal values
|
||||||
// database, it seems to have problems with str() in the where clause...
|
// str(val) on sybase result is right-justified
|
||||||
|
assertEquals( str.length(), 10 );
|
||||||
|
assertTrue( str.endsWith("123") );
|
||||||
|
str = (String) session.createQuery("select str(an.bodyWeight, 8, 3) from Animal an where str(an.bodyWeight, 8, 3) like '%1%'").uniqueResult();
|
||||||
|
assertEquals( str.length(), 8 );
|
||||||
|
assertTrue( str.endsWith( "123.450" ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assertTrue( str.startsWith("123.4") );
|
assertTrue( str.startsWith("123.4") );
|
||||||
|
|
Loading…
Reference in New Issue