mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for wallfilter
This commit is contained in:
@@ -27,7 +27,7 @@ import com.alibaba.druid.wall.WallUtils;
|
||||
*
|
||||
*/
|
||||
public class WallHavingTest extends TestCase {
|
||||
private String sql = "SELECT F1, COUNT(*) FROM T GROUP BY F1 HAVING 1 = 1";
|
||||
private String sql = "SELECT F1, COUNT(*) FROM T GROUP BY F1 HAVING COUNT(*) OR 1 = 1";
|
||||
|
||||
public void testMySql() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql(sql));
|
||||
|
||||
@@ -30,10 +30,10 @@ public class WallSelectWhereTest0 extends TestCase {
|
||||
private String sql = "SELECT F1, F2 WHERE 1 = 1 OR F1 = ?";
|
||||
|
||||
public void testMySql() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql(sql));
|
||||
Assert.assertTrue(WallUtils.isValidateMySql(sql));
|
||||
}
|
||||
|
||||
public void testORACLE() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle(sql));
|
||||
Assert.assertTrue(WallUtils.isValidateOracle(sql));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,20 @@ import com.alibaba.druid.wall.WallUtils;
|
||||
*
|
||||
*/
|
||||
public class WallSelectWhereTest1 extends TestCase {
|
||||
private String sql = "SELECT F1, F2 WHERE 1 = 1 OR FID = ?";
|
||||
|
||||
public void testMySql() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql(sql));
|
||||
public void testMySql_true() throws Exception {
|
||||
Assert.assertTrue(WallUtils.isValidateMySql("SELECT F1, F2 WHERE 1 = 1 OR FID = ?"));
|
||||
}
|
||||
|
||||
public void testORACLE() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle(sql));
|
||||
public void testORACLE_true() throws Exception {
|
||||
Assert.assertTrue(WallUtils.isValidateOracle("SELECT F1, F2 WHERE 1 = 1 OR FID = ?"));
|
||||
}
|
||||
|
||||
public void testMySql_false() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql("SELECT F1, F2 WHERE FID = ? OR 1 = 1"));
|
||||
}
|
||||
|
||||
public void testORACLE_false() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("SELECT F1, F2 WHERE FID = ? OR 1 = 1"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user