Package com.alibaba.druid.wall.spi

Examples of com.alibaba.druid.wall.spi.SQLServerWallProvider


    }
   
    public void testsqlserver() throws Exception {
        String sql = "SELECT F1, F2 FROM ABC --test";

        SQLServerWallProvider provider = new SQLServerWallProvider();
        Assert.assertFalse(provider.checkValid(sql));

        Assert.assertEquals(1, provider.getCommentDenyStat().getDenyCount());
    }
View Full Code Here


        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getSelectCount());
    }

    public void testSQLServer() throws Exception {
        WallProvider provider = new SQLServerWallProvider();
        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getSelectCount());
    }
View Full Code Here

* @see
*/
public class SQLServerWallTest_12 extends TestCase {

    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));

    }
View Full Code Here

            Assert.assertEquals(1, tableStat.getSelectCount());
        }
    }

    public void testSQLServer() throws Exception {
        WallProvider provider = new SQLServerWallProvider();
        Assert.assertTrue(provider.checkValid(sql));
        {
            WallTableStat tableStat = provider.getTableStat("lhwbbs_posts_reply");
            Assert.assertEquals(1, tableStat.getSelectCount());
        }
        {
            WallTableStat tableStat = provider.getTableStat("lhwbbs_posts");
            Assert.assertEquals(1, tableStat.getSelectCount());
        }
    }
View Full Code Here

* @see
*/
public class SQLServerWallTest_4 extends TestCase {

    public void test_true() throws Exception {
        WallProvider provider = new SQLServerWallProvider();

        provider.getConfig().setSelectHavingAlwayTrueCheck(true);

        Assert.assertTrue(provider.checkValid(//
        "insert into t (fid, name) values (1, HOST_NAME())"));

        Assert.assertEquals(1, provider.getTableStats().size());
        Assert.assertTrue(provider.getTableStats().containsKey("t"));
    }
View Full Code Here

* @see
*/
public class SQLServerWallTest_6 extends TestCase {

    public void test_true() throws Exception {
        WallProvider provider = new SQLServerWallProvider();

        provider.getConfig().setSelectHavingAlwayTrueCheck(true);

        Assert.assertFalse(provider.checkValid(//
        "update t set fid = 1 where LEN(HOST_NAME()) > 0"));

        Assert.assertEquals(1, provider.getTableStats().size());
        Assert.assertTrue(provider.getTableStats().containsKey("t"));
    }
View Full Code Here

* @see
*/
public class SQLServerWallTest_11 extends TestCase {

    public void test_true() throws Exception {
        WallProvider provider = new SQLServerWallProvider();
        provider.getConfig().setCommentAllow(true);

        String sql = "SELECT KL_ArticleContent,KL_ArticleTitle " //
                     + "FROM dbo.KL_Article " //
                     + "WHERE KL_ArticleId =-4731 "//
                     + "UNION ALL "//
                     + "SELECT (SELECT TOP 1 CHAR(58)+CHAR(108)+CHAR(107)+CHAR(103)+CHAR(58)+ISNULL(CAST(name AS NVARCHAR(4000)),CHAR(32))+CHAR(58)+CHAR(109)+CHAR(122)+CHAR(104)+CHAR(58) FROM sys.sql_logins WHERE ISNULL(name,CHAR(32)) NOT IN (SELECT TOP 0 ISNULL(name,CHAR(32)) FROM sys.sql_logins ORDER BY 1) ORDER BY 1),NULL-- ";

        Assert.assertFalse(provider.checkValid(sql));

    }
View Full Code Here

* @see
*/
public class SQLServerWallTest_7 extends TestCase {

    public void test_true() throws Exception {
        WallProvider provider = new SQLServerWallProvider();

        provider.getConfig().setSelectHavingAlwayTrueCheck(true);

        Assert.assertTrue(provider.checkValid(//
        "select * from (select top 3000 jol.id as primaryKeyIds, jo.orderNo as 委托单号, bm.custname as 委托方名称, manuCustInfo.custname as 出证方, jo.chkerDate as 委托日期, bcc.connectName as 联系人, bcc.mobile as  电话,jol.barcode as 样品条码, jol.name as 样品名称,  jol.qtysub as 套件数量,jol.OnlyCode as 唯一识别码,jol.manufacture as 制造厂商,jol.sprc as 规格型号, jol.outno as 出厂编号, djod.name as 任务状态, djoc.name  委托类别, dct.name as 证书类型,bdp.organ_name as 分配室组, jol.task_id as 任务ID, be.user_name as 检定人员, verifyUser.user_name as 核验员, checkUser.user_name as 批准员, jol.ddate 交款日期,cjcs.name as 缴款状态, jc.moneys as 应收费, jc.moneystotal as 实收费, be.organ_id from jl_OrderList jol left outer join jl_CheckList jc on jol.checkList_id = jc.id left outer join jl_Order jo on jol.orderid = jo.id left outer join ba_dptinfo bdp on jol.dptid = bdp.id left outer join jl_Task jt on jol.task_id = jt.id left outer join ba_manucustinfo bm on jo.entrustCustId = bm.id left outer join ba_manucustinfo manuCustInfo on jo.custid = manuCustInfo.id left outer join ba_custconnect bcc on jo.linkPerson = bcc.id left outer join ba_employeeinfo be on jt.jdUserId = be.id left outer join ba_employeeinfo verifyUser on jt.verifyUser = verifyUser.id left outer join ba_employeeinfo checkUser on jt.checkUser = checkUser.id left outer join dict_jl_order_doType djod on jol.dotypeid = djod.id left outer join dict_jl_order_class djoc on jo.orderclassid = djoc.id left outer join dict_certificate_type dct on jt.certificatetype = dct.id left outer join dict_jl_chargestatus cjcs on jol.chargestatus = cjcs.id where jol.id >= (select min(primaryKeyId) from (select top  3000 jol.id as primaryKeyId from  jl_OrderList jol left outer join jl_CheckList jc on jol.checkList_id = jc.id left outer join jl_Order jo on jol.orderid = jo.id left outer join ba_dptinfo bdp on jol.dptid = bdp.id left outer join jl_Task jt on jol.task_id = jt.id left outer join ba_manucustinfo bm on jo.entrustCustId = bm.id left outer join ba_manucustinfo manuCustInfo on jo.custid = manuCustInfo.id left outer join ba_custconnect bcc on jo.linkPerson = bcc.id left outer join ba_employeeinfo be on jt.jdUserId = be.id left outer join ba_employeeinfo verifyUser on jt.verifyUser = verifyUser.id left outer join ba_employeeinfo checkUser on jt.checkUser = checkUser.id left outer join dict_jl_order_doType djod on jol.dotypeid = djod.id left outer join dict_jl_order_class djoc on jo.orderclassid = djoc.id left outer join dict_certificate_type dct on jt.certificatetype = dct.id left outer join dict_jl_chargestatus cjcs on jol.chargestatus = cjcs.id where jo.chkerDate >= ? and jo.chkerDate <= ? and jol.ddate >= ? order by jol.id desc, jo.id DESC) as T)  and jo.chkerDate >= ? and jo.chkerDate <= ? and jol.ddate >= ? order by jol.id asc, jo.id DESC) as T1 order by T1.primaryKeyIds desc"));

//        Assert.assertEquals(12, provider.getTableStats().size());
//        Assert.assertTrue(provider.getTableStats().containsKey("jl_OrderList"));
    }
View Full Code Here

        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getDeleteCount());
    }

    public void testSQLServer() throws Exception {
        WallProvider provider = new SQLServerWallProvider();
        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getDeleteCount());
    }
View Full Code Here

        WallTableStat tableStat =  provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getUpdateCount());
    }
   
    public void testSQLServer() throws Exception {
        WallProvider provider = new SQLServerWallProvider();
        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat =  provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getUpdateCount());
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.wall.spi.SQLServerWallProvider

Copyright © 2018 www.massapicom. 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.