Search in sources :

Example 1 with WallFunctionStat

use of com.alibaba.druid.wall.WallFunctionStat in project druid by alibaba.

the class WallStatTest_function_stats method testMySql.

public void testMySql() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    Assert.assertTrue(provider.checkValid(sql));
    {
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getSelectCount());
    }
    {
        WallFunctionStat functionStat = provider.getFunctionStat("len");
        Assert.assertEquals(2, functionStat.getInvokeCount());
    }
    Assert.assertTrue(provider.checkValid(sql));
    {
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(2, tableStat.getSelectCount());
    }
    {
        WallFunctionStat functionStat = provider.getFunctionStat("len");
        Assert.assertEquals(4, functionStat.getInvokeCount());
    }
}
Also used : WallTableStat(com.alibaba.druid.wall.WallTableStat) WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) WallFunctionStat(com.alibaba.druid.wall.WallFunctionStat)

Aggregations

WallFunctionStat (com.alibaba.druid.wall.WallFunctionStat)1 WallProvider (com.alibaba.druid.wall.WallProvider)1 WallTableStat (com.alibaba.druid.wall.WallTableStat)1 MySqlWallProvider (com.alibaba.druid.wall.spi.MySqlWallProvider)1