Package com.alibaba.druid.wall

Examples of com.alibaba.druid.wall.WallProvider.checkValid()


    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();

        provider.getConfig().setCommentAllow(false);

        Assert.assertTrue(provider.checkValid("/* this is comment */ SELECT id FROM t "));
        Assert.assertTrue(provider.checkValid("-- this is comment \n SELECT * FROM t"));
        Assert.assertTrue(provider.checkValid("#this is comment \n SELECT * FROM t"));
       
        Assert.assertFalse(provider.checkValid("/*!40101fff*/ select * from t"));

View Full Code Here


        WallProvider provider = new MySqlWallProvider();

        provider.getConfig().setCommentAllow(false);

        Assert.assertTrue(provider.checkValid("/* this is comment */ SELECT id FROM t "));
        Assert.assertTrue(provider.checkValid("-- this is comment \n SELECT * FROM t"));
        Assert.assertTrue(provider.checkValid("#this is comment \n SELECT * FROM t"));
       
        Assert.assertFalse(provider.checkValid("/*!40101fff*/ select * from t"));

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
View Full Code Here

        provider.getConfig().setCommentAllow(false);

        Assert.assertTrue(provider.checkValid("/* this is comment */ SELECT id FROM t "));
        Assert.assertTrue(provider.checkValid("-- this is comment \n SELECT * FROM t"));
        Assert.assertTrue(provider.checkValid("#this is comment \n SELECT * FROM t"));
       
        Assert.assertFalse(provider.checkValid("/*!40101fff*/ select * from t"));

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
View Full Code Here

        Assert.assertTrue(provider.checkValid("/* this is comment */ SELECT id FROM t "));
        Assert.assertTrue(provider.checkValid("-- this is comment \n SELECT * FROM t"));
        Assert.assertTrue(provider.checkValid("#this is comment \n SELECT * FROM t"));
       
        Assert.assertFalse(provider.checkValid("/*!40101fff*/ select * from t"));

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 /* this is comment */ and d=1"));

View Full Code Here

        Assert.assertTrue(provider.checkValid("-- this is comment \n SELECT * FROM t"));
        Assert.assertTrue(provider.checkValid("#this is comment \n SELECT * FROM t"));
       
        Assert.assertFalse(provider.checkValid("/*!40101fff*/ select * from t"));

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 /* this is comment */ and d=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 \n and e=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- AND c=1 \n and f=1"));
View Full Code Here

        Assert.assertTrue(provider.checkValid("#this is comment \n SELECT * FROM t"));
       
        Assert.assertFalse(provider.checkValid("/*!40101fff*/ select * from t"));

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 /* this is comment */ and d=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 \n and e=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- AND c=1 \n and f=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */ and g=1"));
View Full Code Here

       
        Assert.assertFalse(provider.checkValid("/*!40101fff*/ select * from t"));

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 /* this is comment */ and d=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 \n and e=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- AND c=1 \n and f=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */ and g=1"));

View Full Code Here

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 /* this is comment */ and d=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 \n and e=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- AND c=1 \n and f=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */ and g=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 "));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- and c=1"));
View Full Code Here

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 /* this is comment */ and d=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 \n and e=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- AND c=1 \n and f=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */ and g=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 "));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- and c=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */"));
 
View Full Code Here

        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
        Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 /* this is comment */ and d=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 \n and e=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- AND c=1 \n and f=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */ and g=1"));

        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 "));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- and c=1"));
        Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */"));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.