Search in sources :

Example 91 with WallProvider

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

the class MySqlWallTest_concat method test_true.

public void test_true() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    provider.getConfig().setSelectHavingAlwayTrueCheck(true);
    Assert.assertTrue(//
    provider.checkValid("select * from tb_product_word where name='' or CONCAT(name,style)='' or CONCAT(shop,style)=''  or CONCAT(ename,style)=''"));
    Assert.assertEquals(1, provider.getTableStats().size());
    Assert.assertTrue(provider.getTableStats().containsKey("tb_product_word"));
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider)

Example 92 with WallProvider

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

the class MySqlWallTest65 method test_false.

public void test_false() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    provider.getConfig().setSchemaCheck(true);
    Assert.assertFalse(//
    provider.checkValid("SELECT email, passwd, login_id, full_name" + " FROM members" + " WHERE member_id = 3 AND 0<(SELECT COUNT(*) FROM tabname);"));
    Assert.assertEquals(2, provider.getTableStats().size());
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider)

Example 93 with WallProvider

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

the class MySqlWallTest69 method test_true.

public void test_true() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    provider.getConfig().setCommentAllow(true);
    Assert.assertTrue(//
    provider.checkValid("select * from T--"));
    Assert.assertEquals(1, provider.getTableStats().size());
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider)

Example 94 with WallProvider

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

the class MySqlWallTest70 method test_true.

public void test_true() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    provider.getConfig().setCommentAllow(true);
    Assert.assertTrue(//
    provider.checkValid("select * from T/**/"));
    Assert.assertEquals(1, provider.getTableStats().size());
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider)

Example 95 with WallProvider

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

the class MySqlWallTest71 method test_false1.

public void test_false1() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    provider.getConfig().setCommentAllow(true);
    Assert.assertFalse(//
    provider.checkValid("select * from order_return where return_goods_money =0.00 ,return_other_money = 8--149.00, return_total_fee = ifnull(return_shipping,0)+ifnull(return_other_discount,0)+0.00--149.00-0.00,return_goods_amount=1,return_real_money=0.00"));
    Assert.assertEquals(1, provider.getTableStats().size());
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider)

Aggregations

WallProvider (com.alibaba.druid.wall.WallProvider)195 MySqlWallProvider (com.alibaba.druid.wall.spi.MySqlWallProvider)182 SQLServerWallProvider (com.alibaba.druid.wall.spi.SQLServerWallProvider)47 WallTableStat (com.alibaba.druid.wall.WallTableStat)41 PGWallProvider (com.alibaba.druid.wall.spi.PGWallProvider)36 OracleWallProvider (com.alibaba.druid.wall.spi.OracleWallProvider)34 WallCheckResult (com.alibaba.druid.wall.WallCheckResult)3 Violation (com.alibaba.druid.wall.Violation)2 SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)1 PGSQLStatementParser (com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser)1 PGSchemaStatVisitor (com.alibaba.druid.sql.dialect.postgresql.visitor.PGSchemaStatVisitor)1 WallConfig (com.alibaba.druid.wall.WallConfig)1 WallFunctionStat (com.alibaba.druid.wall.WallFunctionStat)1 Map (java.util.Map)1 Test (org.junit.Test)1