Search in sources :

Example 71 with WallConfig

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

the class DoPrivilegedTest method test_1.

public void test_1() throws Exception {
    final WallConfig config = new WallConfig();
    config.setDoPrivilegedAllow(true);
    WallProvider.doPrivileged(new PrivilegedAction<Object>() {

        @Override
        public Object run() {
            Assert.assertTrue(WallUtils.isValidateMySql("select @@version_compile_os FROM X", config));
            return null;
        }
    });
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Example 72 with WallConfig

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

the class IntersectTest method test_false.

public void test_false() throws Exception {
    WallConfig config = new WallConfig();
    config.setMinusAllow(false);
    Assert.assertFalse(//
    WallUtils.isValidateOracle("SELECT * FROM A MINUS SELECT * FROM B", //
    config));
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Example 73 with WallConfig

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

the class MinusTest method test_false.

public void test_false() throws Exception {
    WallConfig config = new WallConfig();
    config.setIntersectAllow(false);
    Assert.assertFalse(//
    WallUtils.isValidateOracle("SELECT * FROM A Intersect SELECT * FROM B", //
    config));
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Example 74 with WallConfig

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

the class StrictSyntaxCheckTest method test_syntax_1.

public void test_syntax_1() throws Exception {
    WallConfig config = new WallConfig();
    config.setStrictSyntaxCheck(false);
    Assert.assertTrue(//
    WallUtils.isValidateMySql("SELECT SELECT", // 部分永真
    config));
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Example 75 with WallConfig

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

the class BigSqlTest method test_true2.

public void test_true2() throws Exception {
    String sql = "SELECT c from sbtest where id=0";
    for (int i = 0; i < 10000; i++) {
        sql += " and id=0";
    }
    WallConfig config = new WallConfig();
    Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Aggregations

WallConfig (com.alibaba.druid.wall.WallConfig)83 Properties (java.util.Properties)8 WallFilter (com.alibaba.druid.wall.WallFilter)5 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)4 WallCheckResult (com.alibaba.druid.wall.WallCheckResult)3 Filter (com.alibaba.druid.filter.Filter)2 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)2 OracleMockDriver (com.alibaba.druid.test.util.OracleMockDriver)2 WallContext (com.alibaba.druid.wall.WallContext)2 MySqlWallProvider (com.alibaba.druid.wall.spi.MySqlWallProvider)2 SQLCommentHint (com.alibaba.druid.sql.ast.SQLCommentHint)1 SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)1 SQLStartTransactionStatement (com.alibaba.druid.sql.ast.statement.SQLStartTransactionStatement)1 MySqlCommitStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCommitStatement)1 MySqlDeleteStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement)1 MySqlDescribeStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDescribeStatement)1 MySqlHintStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlHintStatement)1 MySqlLockTableStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlLockTableStatement)1 MySqlRenameTableStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStatement)1 MySqlReplaceStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement)1