Search in sources :

Example 1 with OracleWallProvider

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

the class WallStatTest_drop_table method testOracle.

public void testOracle() throws Exception {
    WallProvider provider = new OracleWallProvider();
    provider.getConfig().setDropTableAllow(true);
    Assert.assertTrue(provider.checkValid(sql));
    WallTableStat tableStat = provider.getTableStat("t");
    Assert.assertEquals(1, tableStat.getDropCount());
}
Also used : WallTableStat(com.alibaba.druid.wall.WallTableStat) OracleWallProvider(com.alibaba.druid.wall.spi.OracleWallProvider) WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) OracleWallProvider(com.alibaba.druid.wall.spi.OracleWallProvider) PGWallProvider(com.alibaba.druid.wall.spi.PGWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 2 with OracleWallProvider

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

the class WallStatTest_insert method testOracle.

public void testOracle() throws Exception {
    WallProvider provider = new OracleWallProvider();
    Assert.assertTrue(provider.checkValid(sql));
    WallTableStat tableStat = provider.getTableStat("t");
    Assert.assertEquals(1, tableStat.getInsertCount());
}
Also used : WallTableStat(com.alibaba.druid.wall.WallTableStat) OracleWallProvider(com.alibaba.druid.wall.spi.OracleWallProvider) WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) OracleWallProvider(com.alibaba.druid.wall.spi.OracleWallProvider) PGWallProvider(com.alibaba.druid.wall.spi.PGWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 3 with OracleWallProvider

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

the class WallReadOnlyTest2 method testORACLE.

public void testORACLE() throws Exception {
    OracleWallProvider provider = new OracleWallProvider(config);
    Assert.assertTrue(provider.checkValid(sql));
    Assert.assertFalse(provider.checkValid(insert_sql));
    Assert.assertFalse(provider.checkValid(update_sql));
    Assert.assertFalse(provider.checkValid(delete_sql));
}
Also used : OracleWallProvider(com.alibaba.druid.wall.spi.OracleWallProvider)

Example 4 with OracleWallProvider

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

the class WallStatTest_select_into method testOracle.

public void testOracle() throws Exception {
    WallProvider provider = new OracleWallProvider();
    Assert.assertTrue(provider.checkValid(sql));
    WallTableStat tableStat = provider.getTableStat("t");
    Assert.assertEquals(1, tableStat.getSelectCount());
}
Also used : WallTableStat(com.alibaba.druid.wall.WallTableStat) OracleWallProvider(com.alibaba.druid.wall.spi.OracleWallProvider) WallProvider(com.alibaba.druid.wall.WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) OracleWallProvider(com.alibaba.druid.wall.spi.OracleWallProvider) PGWallProvider(com.alibaba.druid.wall.spi.PGWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Example 5 with OracleWallProvider

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

the class WallFilter method init.

@Override
public synchronized void init(DataSourceProxy dataSource) {
    if (null == dataSource) {
        LOG.error("dataSource should not be null");
        return;
    }
    if (this.dbType == null || this.dbType.trim().length() == 0) {
        if (dataSource.getDbType() != null) {
            this.dbType = dataSource.getDbType();
        } else {
            this.dbType = JdbcUtils.getDbType(dataSource.getRawJdbcUrl(), "");
        }
    }
    if (dbType == null) {
        dbType = JdbcUtils.getDbType(dataSource.getUrl(), null);
    }
    if (//
    JdbcUtils.MYSQL.equals(dbType) || //
    JdbcUtils.MARIADB.equals(dbType) || JdbcUtils.H2.equals(dbType)) {
        if (config == null) {
            config = new WallConfig(MySqlWallProvider.DEFAULT_CONFIG_DIR);
        }
        provider = new MySqlWallProvider(config);
    } else if (JdbcUtils.ORACLE.equals(dbType) || JdbcUtils.ALI_ORACLE.equals(dbType)) {
        if (config == null) {
            config = new WallConfig(OracleWallProvider.DEFAULT_CONFIG_DIR);
        }
        provider = new OracleWallProvider(config);
    } else if (JdbcUtils.SQL_SERVER.equals(dbType) || JdbcUtils.JTDS.equals(dbType)) {
        if (config == null) {
            config = new WallConfig(SQLServerWallProvider.DEFAULT_CONFIG_DIR);
        }
        provider = new SQLServerWallProvider(config);
    } else if (JdbcUtils.POSTGRESQL.equals(dbType) || JdbcUtils.ENTERPRISEDB.equals(dbType)) {
        if (config == null) {
            config = new WallConfig(PGWallProvider.DEFAULT_CONFIG_DIR);
        }
        provider = new PGWallProvider(config);
    } else if (JdbcUtils.DB2.equals(dbType)) {
        if (config == null) {
            config = new WallConfig(DB2WallProvider.DEFAULT_CONFIG_DIR);
        }
        provider = new DB2WallProvider(config);
    } else {
        throw new IllegalStateException("dbType not support : " + dbType + ", url " + dataSource.getUrl());
    }
    provider.setName(dataSource.getName());
    this.inited = true;
}
Also used : OracleWallProvider(com.alibaba.druid.wall.spi.OracleWallProvider) DB2WallProvider(com.alibaba.druid.wall.spi.DB2WallProvider) MySqlWallProvider(com.alibaba.druid.wall.spi.MySqlWallProvider) PGWallProvider(com.alibaba.druid.wall.spi.PGWallProvider) SQLServerWallProvider(com.alibaba.druid.wall.spi.SQLServerWallProvider)

Aggregations

OracleWallProvider (com.alibaba.druid.wall.spi.OracleWallProvider)14 MySqlWallProvider (com.alibaba.druid.wall.spi.MySqlWallProvider)10 PGWallProvider (com.alibaba.druid.wall.spi.PGWallProvider)10 SQLServerWallProvider (com.alibaba.druid.wall.spi.SQLServerWallProvider)10 WallProvider (com.alibaba.druid.wall.WallProvider)9 WallTableStat (com.alibaba.druid.wall.WallTableStat)9 DB2WallProvider (com.alibaba.druid.wall.spi.DB2WallProvider)1