mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add testcase
This commit is contained in:
@@ -26,11 +26,11 @@ public class MergeStatFilterTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_merge() throws Exception {
|
||||
String sql = IOUtils.read(new InputStreamReader(this.getClass().getResourceAsStream("/bvt/parser/postgresql.txt")));
|
||||
//System.out.println(sql);
|
||||
String sqllist = IOUtils.read(new InputStreamReader(this.getClass().getResourceAsStream("/bvt/parser/postgresql.txt")));
|
||||
String[] ss = sqllist.split("--");
|
||||
for(String sql:ss)
|
||||
{
|
||||
Connection conn = dataSource.getConnection();
|
||||
|
||||
Statement stmt = conn.createStatement();
|
||||
stmt.execute(sql);
|
||||
stmt.close();
|
||||
@@ -41,8 +41,7 @@ public class MergeStatFilterTest3 extends TestCase {
|
||||
Assert.assertEquals(1, dataSource.getDataSourceStat().getSqlStatMap()
|
||||
.size());
|
||||
System.out.println(dataSource.getDataSourceStat().getSqlStatMap().keySet().iterator().next());
|
||||
System.out.println("---------------------------------------------------");
|
||||
System.out.println(SQLUtils.formatPGSql(sql));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,3 +17,24 @@
|
||||
where stat_date = '2012-02-19'
|
||||
and admin_member_seq = ?) b
|
||||
Order by sum_prod_show_num desc, product_id desc) a limit ? offset (? -1) * ?
|
||||
--
|
||||
|
||||
/*!cobar: select,4,ireport.dm_mdm_mem_prod_effect_sdt0.admin_member_seq=201152175*/
|
||||
select product_id,
|
||||
sum_prod_show_num,
|
||||
sum_prod_click_num,
|
||||
sum_prod_fb_num,
|
||||
total_cnt
|
||||
from (select product_id,
|
||||
sum_prod_show_num,
|
||||
sum_prod_click_num,
|
||||
sum_prod_fb_num,
|
||||
count(*) over(order by a,ba,c) as total_cnt
|
||||
from (select product_id,
|
||||
sum_prod_show_num,
|
||||
sum_prod_click_num,
|
||||
sum_prod_fb_num
|
||||
from ireport.dm_mdm_mem_prod_effect_sdt0
|
||||
where stat_date = '2012-03-20'
|
||||
and admin_member_seq = ?) b
|
||||
Order by sum_prod_show_num desc, product_id desc) a limit ? offset (? -1) * ?
|
||||
Reference in New Issue
Block a user