use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class WallUnionTest method testMySql.
public void testMySql() throws Exception {
WallConfig config = new WallConfig();
config.setSelectUnionCheck(true);
Assert.assertTrue(WallUtils.isValidateMySql("select f1, f2 from t where f1=1 union select 1, 2", config));
Assert.assertFalse(WallUtils.isValidateMySql("select f1, f2 from t where f1=1 union select 1, 2 --", config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class WallUnionTest2 method testOracle.
public void testOracle() throws Exception {
WallConfig config = new WallConfig();
config.setSelectUnionCheck(true);
Assert.assertTrue(WallUtils.isValidateOracle("select f1, f2 from t where f1 = 1 union select 1, 2 where 1 = 1", config));
Assert.assertFalse(WallUtils.isValidateOracle("select f1, f2 from t where f1 = 1 union select 1, 2 where 1 = 1 --", config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class WallUnionTest2 method testMySql.
public void testMySql() throws Exception {
WallConfig config = new WallConfig();
config.setSelectUnionCheck(true);
Assert.assertTrue(WallUtils.isValidateMySql("select f1, f2 from t where f1 = 1 union select 1, 2 where 1 = 1", config));
Assert.assertFalse(WallUtils.isValidateMySql("select f1, f2 from t where f1 = 1 union select 1, 2 where 1 = 1 --", config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class WallUnionTest4 method testORACLE.
public void testORACLE() throws Exception {
WallConfig config = new WallConfig();
config.setSelectUnionCheck(true);
Assert.assertTrue(WallUtils.isValidateOracle("SELECT id, product FROM T1 t where id=1 UNION (SELECT * FROM (SELECT 1,'x') X)", config));
Assert.assertFalse(WallUtils.isValidateOracle("SELECT id, product FROM T1 t where id=1 UNION (SELECT * FROM (SELECT 1,'x') X) -- ", config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class WallUpdateTest2 method testMySql_false.
public void testMySql_false() throws Exception {
WallConfig config = new WallConfig();
config.setUpdateAllow(false);
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
}
Aggregations