Search in sources :

Example 6 with SQLServerWallProvider

use of com.alibaba.druid.wall.spi.SQLServerWallProvider in project druid by alibaba.

the class SQLServerWallTest_5 method test_true.

public void test_true() throws Exception {
    WallProvider provider = new SQLServerWallProvider();
    provider.getConfig().setSelectHavingAlwayTrueCheck(true);
    Assert.assertFalse(// 
    provider.checkValid("delete t where LEN(HOST_NAME()) > 0"));
    Assert.assertEquals(1, provider.getTableStats().size());
    Assert.assertTrue(provider.getTableStats().containsKey("t"));
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 7 with SQLServerWallProvider

use of com.alibaba.druid.wall.spi.SQLServerWallProvider in project druid by alibaba.

the class SQLServerWallTest_7 method test_true.

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"));
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 8 with SQLServerWallProvider

use of com.alibaba.druid.wall.spi.SQLServerWallProvider in project druid by alibaba.

the class SQLServerWallTest_9 method test_true.

public void test_true() throws Exception {
    WallProvider provider = new SQLServerWallProvider();
    String sql = // 
    "SELECT s.id FROM snapshots s " + // 
    "WHERE s.scope='PRJ'" + // 
    " and s.qualifier IN ('TRK', 'BRC')" + // 
    " AND status='P'" + // 
    " AND islast=0" + " AND NOT EXISTS (select m.id from project_measures m WHERE m.snapshot_id=s.id)";
    Assert.assertTrue(provider.checkValid(sql));
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 9 with SQLServerWallProvider

use of com.alibaba.druid.wall.spi.SQLServerWallProvider in project druid by alibaba.

the class SQLServerWallTest_0 method initWallProvider.

private WallProvider initWallProvider() {
    WallProvider provider = new SQLServerWallProvider();
    provider.getConfig().setStrictSyntaxCheck(false);
    provider.getConfig().setMultiStatementAllow(true);
    provider.getConfig().setConditionAndAlwayTrueAllow(true);
    provider.getConfig().setNoneBaseStatementAllow(true);
    provider.getConfig().setLimitZeroAllow(true);
    provider.getConfig().setConditionDoubleConstAllow(true);
    provider.getConfig().setCommentAllow(true);
    provider.getConfig().setSelectUnionCheck(false);
    return provider;
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 10 with SQLServerWallProvider

use of com.alibaba.druid.wall.spi.SQLServerWallProvider in project druid by alibaba.

the class SQLServerWallTest_10 method test_true.

public void test_true() throws Exception {
    WallProvider provider = new SQLServerWallProvider();
    String sql = "select top 50 * FROM [V_Goods_WithAvailableStockQuantity] where Status='����' and (Code like '%mu%' ESCAPE '\' or Model like '%mu%' ESCAPE '\' or Spec like '%mu%' ESCAPE '\' or BarCode like '%mu%' ESCAPE '\' or ProductName like '%mu%' ESCAPE '\' or dbo.F_GetPY(ProductName) like '%mu%' ESCAPE '\') ";
    Assert.assertTrue(provider.checkValid(sql));
}
Also used : WallProvider(com.alibaba.druid.wall.WallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Aggregations

SQLServerWallProvider (com.alibaba.druid.wall.spi.SQLServerWallProvider)22 WallProvider (com.alibaba.druid.wall.WallProvider)21 MySqlWallProvider (com.alibaba.druid.wall.spi.MySqlWallProvider)10 OracleWallProvider (com.alibaba.druid.wall.spi.OracleWallProvider)9 PGWallProvider (com.alibaba.druid.wall.spi.PGWallProvider)9 WallTableStat (com.alibaba.druid.wall.WallTableStat)8