use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class WallStatTest_select_into method testOracle.
public void testOracle() throws Exception {
WallProvider provider = new OracleWallProvider();
Assert.assertTrue(provider.checkValid(sql));
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(1, tableStat.getSelectCount());
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class WallStatTest_update 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.getUpdateCount());
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class WallStatTest_update method testSQLServer.
public void testSQLServer() throws Exception {
WallProvider provider = new SQLServerWallProvider();
Assert.assertTrue(provider.checkValid(sql));
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(1, tableStat.getUpdateCount());
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class WallStatTest_whiteList_syntaxError method testMySql.
public void testMySql() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setStrictSyntaxCheck(false);
String sql = "select xx * x *";
Assert.assertTrue(provider.checkValid(sql));
{
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(0, tableStat.getSelectCount());
Assert.assertEquals(0, provider.getBlackListHitCount());
Assert.assertEquals(0, provider.getWhiteListHitCount());
Assert.assertEquals(0, provider.getWhiteList().size());
Assert.assertEquals(0, provider.getBlackList().size());
Assert.assertEquals(1, provider.getCheckCount());
Assert.assertEquals(1, provider.getSyntaxErrorCount());
Assert.assertEquals(1, provider.getHardCheckCount());
}
Assert.assertTrue(provider.checkValid(sql));
{
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(0, tableStat.getSelectCount());
Assert.assertEquals(0, provider.getBlackListHitCount());
Assert.assertEquals(0, provider.getWhiteListHitCount());
Assert.assertEquals(0, provider.getWhiteList().size());
Assert.assertEquals(0, provider.getBlackList().size());
Assert.assertEquals(2, provider.getCheckCount());
Assert.assertEquals(2, provider.getSyntaxErrorCount());
Assert.assertEquals(2, provider.getHardCheckCount());
}
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class MySqlWallTest139 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
String sql = //
"select count(1) as total " + //
" from (" + //
" select '' buyer_nick from dual " + //
" where 1=0 " + //
" union " + //
" select distinct buyer_nick " + //
" from sys_info.orders " + //
" where 1=1 and receiver_district in ('平谷区')" + //
") a " + //
"inner join (" + //
" select buyer_nick from (" + //
" select distinct buyer_nick " + //
" from sys_info.orders " + //
" where 1=1 and created > '2013-07-28' " + //
" ) recent_days " + //
"inner join (" + //
" select distinct buyer_nick " + //
" from sys_info.orders " + //
" where 1=1 and seller_nick in ('创维官方旗舰店') " + //
" ) seller_nick using(buyer_nick) " + ") b using(buyer_nick)";
Assert.assertTrue(provider.checkValid(sql));
}
Aggregations