mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
fix issue #471 DB2数据库SQL带ORDER BY的分页查询生成的语句不对
This commit is contained in:
@@ -50,4 +50,15 @@ public class PagerUtilsTest_Limit_db2_0 extends TestCase {
|
||||
+ "\nWHERE ROWNUM > 20"//
|
||||
+ "\n\tAND ROWNUM <= 30", result);
|
||||
}
|
||||
|
||||
public void test_fetch_order() {
|
||||
String sql="SELECT t.CUSTNAME AS custname\n" +
|
||||
"FROM CPS_LOAN_INFO t WHERE t.DEL_FLAG = 0\n" +
|
||||
"ORDER BY t.CREATE_TIME DESC";
|
||||
|
||||
String limitSql=PagerUtils.limit(sql, JdbcConstants.DB2,0,20) ;
|
||||
int fetchRowIndex=limitSql.indexOf("FETCH FIRST");
|
||||
int orderIndex=limitSql.indexOf("ORDER BY") ;
|
||||
Assert.assertTrue(fetchRowIndex>orderIndex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user