mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add testcase for #4010
This commit is contained in:
@@ -30,6 +30,20 @@ public class PagerUtilsTest_Count_PG_0 extends TestCase {
|
||||
"FROM t", result);
|
||||
}
|
||||
|
||||
public void test_pg_3() throws Exception {
|
||||
String sql = "select * from test where shape.STIntersects(geometry::STGeomFromText('POLYGON ((86610.054 86610.054,112372.95799999963 88785.5940000005,112372.91199999955 88675.996999999508,86610.054 86610.054))',0))=1;";
|
||||
String countSql = PagerUtils.count(sql, JdbcConstants.POSTGRESQL);
|
||||
assertEquals("SELECT COUNT(*)\n" +
|
||||
"FROM test\n" +
|
||||
"WHERE shape.STIntersects(geometry::STGeomFromText('POLYGON ((86610.054 86610.054,112372.95799999963 88785.5940000005,112372.91199999955 88675.996999999508,86610.054 86610.054))', 0)) = 1", countSql);
|
||||
|
||||
String limitSql = PagerUtils.limit(sql, JdbcConstants.POSTGRESQL, 100, 10);
|
||||
assertEquals("SELECT *\n" +
|
||||
"FROM test\n" +
|
||||
"WHERE shape.STIntersects(geometry::STGeomFromText('POLYGON ((86610.054 86610.054,112372.95799999963 88785.5940000005,112372.91199999955 88675.996999999508,86610.054 86610.054))', 0)) = 1\n" +
|
||||
"LIMIT 10 OFFSET 100", limitSql);
|
||||
}
|
||||
|
||||
public void test_pg_group_0() throws Exception {
|
||||
String sql = "select type, count(*) from t group by type";
|
||||
String result = PagerUtils.count(sql, JdbcConstants.POSTGRESQL);
|
||||
@@ -53,4 +67,5 @@ public class PagerUtilsTest_Count_PG_0 extends TestCase {
|
||||
"\tFROM t2\n" +
|
||||
") ALIAS_COUNT", result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user