Search in sources :

Example 71 with WallProvider

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

the class SQLServerWallTest_12 method test_true.

public void test_true() throws Exception {
    WallProvider provider = new SQLServerWallProvider();
    provider.getConfig().setCommentAllow(true);
    String sql = "EXEC master..xp_msver";
    Assert.assertTrue(provider.checkValid(sql));
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 72 with WallProvider

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

the class SQLServerWallTest_5 method test_true.

public void test_true() throws Exception {
    WallProvider provider = new SQLServerWallProvider();
    provider.getConfig().setSelectHavingAlwayTrueCheck(true);
    Assert.assertFalse(//
    provider.checkValid("delete t where LEN(HOST_NAME()) > 0"));
    Assert.assertEquals(1, provider.getTableStats().size());
    Assert.assertTrue(provider.getTableStats().containsKey("t"));
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 73 with WallProvider

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

the class MySqlWallTest50 method test_false.

public void test_false() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    Assert.assertTrue(//
    provider.checkValid("SHOW /*  113.97.255.240 */ GLOBAL VARIABLES LIKE 'ft\\_min\\_word\\_len'"));
    Assert.assertEquals(0, 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 74 with WallProvider

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

the class MySqlWallTest51 method test_true.

public void test_true() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    Assert.assertTrue(//
    provider.checkValid("REPLACE /* SearchMySQL::update Wikiadmin */ INTO `wiki_searchindex` (si_page,si_title,si_text) VALUES ('15',' u8e5858d u8e8b4a3 u8e5a3b0 u8e6988e')"));
    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 75 with WallProvider

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

the class MySqlWallTest52 method test_false.

public void test_false() throws Exception {
    WallProvider provider = new MySqlWallProvider();
    Assert.assertFalse(//
    provider.checkValid("select * from t limit 0"));
    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