forked from alibaba/druid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fixed for PagerUtils, for issue alibaba#3081
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/test/java/com/alibaba/druid/bvt/sql/PagerUtilsTest_Limit_SQLServer_6.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |