HHH-5726 update test case

This commit is contained in:
Strong Liu 2010-11-29 18:11:44 +08:00
parent 915d6f9eea
commit 5aed6b19cb
2 changed files with 4 additions and 16 deletions

View File

@ -56,16 +56,6 @@ public class SQLServer2005Dialect extends SQLServerDialect {
registerFunction("row_number", new NoArgSQLFunction("row_number", StandardBasicTypes.INTEGER, true));
}
@Override
public boolean supportsLimit() {
return true;
}
@Override
public boolean useMaxForLimit() {
return true;
}
@Override
public boolean supportsLimitOffset() {
@ -145,11 +135,10 @@ public class SQLServer2005Dialect extends SQLServerDialect {
/**
* Utility method that checks if the given sql query is a select distinct one and if so replaces the distinct select
* with an equivelant simple select with a group by clause. See
* with an equivalent simple select with a group by clause. See
* {@link SQLServer2005DialectTestCase#testReplaceDistinctWithGroupBy()}
*
* @param an
* sql query
* @param sql an sql query
*/
protected static void replaceDistinctWithGroupBy(StringBuilder sql) {
int distinctIndex = sql.indexOf(DISTINCT);
@ -197,7 +186,7 @@ public class SQLServer2005Dialect extends SQLServerDialect {
// Find the end of the select statement
int selectEndIndex = sql.indexOf(SELECT) + SELECT.length();
// Isert after the select statement the row_number() function:
// Insert after the select statement the row_number() function:
sql.insert(selectEndIndex, " ROW_NUMBER() OVER (" + orderby + ") as __hibernate_row_nr__,");
}
}

View File

@ -36,7 +36,6 @@ public class SQLServer2005DialectTestCase extends TestCase {
String input = "select distinct f1 as f53245 from table849752 order by f234, f67 desc";
Dialect sqlDialect = new SQLServer2005Dialect();
assertEquals( "with query as (select row_number() over (order by f234, f67 desc) as __hibernate_row_nr__, f1 as f53245 from table849752 group by f1) select * from query where __hibernate_row_nr__ between 11 and 15", sqlDialect.getLimitString(input, 10, 15).toLowerCase() );
assertEquals( "with query as (select row_number() over (order by f234, f67 desc) as __hibernate_row_nr__, f1 as f53245 from table849752 group by f1) select * from query where __hibernate_row_nr__ between ? and ?", sqlDialect.getLimitString(input, 10, 15).toLowerCase() );
}
}