bug fixed for PagerUtils, for issue #3081

This commit is contained in:
shaojin.wensj
2019-02-22 21:19:44 +08:00
parent c732a3569a
commit 24a83cddd1
2 changed files with 28 additions and 2 deletions
@@ -0,0 +1,21 @@
package com.alibaba.druid.bvt.sql;
import com.alibaba.druid.sql.PagerUtils;
import com.alibaba.druid.util.JdbcConstants;
import junit.framework.TestCase;
import org.junit.Assert;
public class PagerUtilsTest_Limit_SQLServer_6 extends TestCase {
public void test_db2_union() throws Exception {
String sql = "SELECT t.name USER_NAME, t.xxx FROM t_sd_users t ORDER BY t.name ASC";
String result = PagerUtils.limit(sql, JdbcConstants.SQL_SERVER, 10, 10);
Assert.assertEquals("SELECT *\n" +
"FROM (\n" +
"\tSELECT t.name AS USER_NAME, t.xxx, ROW_NUMBER() OVER (ORDER BY t.name ASC) AS ROWNUM\n" +
"\tFROM t_sd_users t\n" +
") XX\n" +
"WHERE ROWNUM > 10\n" +
"\tAND ROWNUM <= 20", result);
}
}