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());
}
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());
}
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));
}
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());
}
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;
}
Aggregations