add testcase for #4010

This commit is contained in:
高铁
2020-11-03 11:49:24 +08:00
parent 21862798fb
commit 0699171fa5
@@ -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);
}
}