mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #235 from wenshao/master
request for approval for bulk integration
This commit is contained in:
@@ -86,7 +86,11 @@ public class PreparedStatementProxyImpl extends StatementProxyImpl implements Pr
|
||||
@Override
|
||||
public boolean execute() throws SQLException {
|
||||
updateCount = null;
|
||||
lastExecuteSql = sql;
|
||||
lastExecuteType = StatementExecuteType.Execute;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
firstResultSet = createChain().preparedStatement_execute(this);
|
||||
return firstResultSet;
|
||||
}
|
||||
@@ -94,15 +98,26 @@ public class PreparedStatementProxyImpl extends StatementProxyImpl implements Pr
|
||||
@Override
|
||||
public ResultSet executeQuery() throws SQLException {
|
||||
firstResultSet = true;
|
||||
|
||||
updateCount = null;
|
||||
lastExecuteSql = sql;
|
||||
lastExecuteType = StatementExecuteType.ExecuteQuery;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
return createChain().preparedStatement_executeQuery(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdate() throws SQLException {
|
||||
firstResultSet = false;
|
||||
|
||||
updateCount = null;
|
||||
lastExecuteSql = sql;
|
||||
lastExecuteType = StatementExecuteType.ExecuteUpdate;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
updateCount = createChain().preparedStatement_executeUpdate(this);
|
||||
return updateCount;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
private final Statement statement;
|
||||
|
||||
protected String lastExecuteSql;
|
||||
private long lastExecuteStartNano;
|
||||
private long lastExecuteTimeNano;
|
||||
protected long lastExecuteStartNano;
|
||||
protected long lastExecuteTimeNano;
|
||||
|
||||
protected JdbcSqlStat sqlStat;
|
||||
protected boolean firstResultSet;
|
||||
@@ -111,7 +111,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.Execute;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
firstResultSet = createChain().statement_execute(this, sql);
|
||||
return firstResultSet;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.Execute;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
firstResultSet = createChain().statement_execute(this, sql, autoGeneratedKeys);
|
||||
return firstResultSet;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.Execute;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
firstResultSet = createChain().statement_execute(this, sql, columnIndexes);
|
||||
return firstResultSet;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.Execute;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
firstResultSet = createChain().statement_execute(this, sql, columnNames);
|
||||
return firstResultSet;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.ExecuteBatch;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
int[] updateCounts = createChain().statement_executeBatch(this);
|
||||
|
||||
if (updateCounts != null && updateCounts.length == 1) {
|
||||
@@ -176,7 +176,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.ExecuteQuery;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
return createChain().statement_executeQuery(this, sql);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.ExecuteUpdate;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
updateCount = createChain().statement_executeUpdate(this, sql);
|
||||
return updateCount;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.ExecuteUpdate;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
updateCount = createChain().statement_executeUpdate(this, sql, autoGeneratedKeys);
|
||||
return updateCount;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.ExecuteUpdate;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
updateCount = createChain().statement_executeUpdate(this, sql, columnIndexes);
|
||||
return updateCount;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
lastExecuteType = StatementExecuteType.ExecuteUpdate;
|
||||
lastExecuteStartNano = -1L;
|
||||
lastExecuteTimeNano = -1L;
|
||||
|
||||
|
||||
updateCount = createChain().statement_executeUpdate(this, sql, columnNames);
|
||||
return updateCount;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ public class StatementProxyImpl extends WrapperProxyImpl implements StatementPro
|
||||
public void setLastExecuteTimeNano(long lastExecuteTimeNano) {
|
||||
this.lastExecuteTimeNano = lastExecuteTimeNano;
|
||||
}
|
||||
|
||||
|
||||
public void setLastExecuteTimeNano() {
|
||||
if (this.lastExecuteTimeNano <= 0 && this.lastExecuteStartNano > 0) {
|
||||
this.lastExecuteTimeNano = System.nanoTime() - this.lastExecuteStartNano;
|
||||
|
||||
@@ -24,353 +24,363 @@ import com.alibaba.druid.wall.spi.WallVisitorUtils;
|
||||
|
||||
public class WallConfig implements WallConfigMBean {
|
||||
|
||||
private boolean noneBaseStatementAllow = false;
|
||||
private boolean noneBaseStatementAllow = false;
|
||||
|
||||
private boolean callAllow = true;
|
||||
private boolean selelctAllow = true;
|
||||
private boolean selectIntoAllow = true;
|
||||
private boolean selectIntoOutfileAllow = false;
|
||||
private boolean selectWhereAlwayTrueCheck = true;
|
||||
private boolean selectHavingAlwayTrueCheck = true;
|
||||
private boolean selectUnionCheck = true;
|
||||
private boolean callAllow = true;
|
||||
private boolean selelctAllow = true;
|
||||
private boolean selectIntoAllow = true;
|
||||
private boolean selectIntoOutfileAllow = false;
|
||||
private boolean selectWhereAlwayTrueCheck = true;
|
||||
private boolean selectHavingAlwayTrueCheck = true;
|
||||
private boolean selectUnionCheck = true;
|
||||
|
||||
private boolean deleteAllow = true;
|
||||
private boolean deleteWhereAlwayTrueCheck = true;
|
||||
private boolean deleteAllow = true;
|
||||
private boolean deleteWhereAlwayTrueCheck = true;
|
||||
|
||||
private boolean updateAllow = true;
|
||||
private boolean updateWhereAlayTrueCheck = true;
|
||||
private boolean updateAllow = true;
|
||||
private boolean updateWhereAlayTrueCheck = true;
|
||||
|
||||
private boolean insertAllow = true;
|
||||
private boolean mergeAllow = true;
|
||||
private boolean insertAllow = true;
|
||||
private boolean mergeAllow = true;
|
||||
|
||||
private boolean multiStatementAllow = false;
|
||||
private boolean multiStatementAllow = false;
|
||||
|
||||
private boolean truncateAllow = false;
|
||||
private boolean truncateAllow = false;
|
||||
|
||||
private boolean commentAllow = false;
|
||||
private boolean commentAllow = false;
|
||||
|
||||
private boolean schemaCheck = true;
|
||||
private boolean tableCheck = true;
|
||||
private boolean functionCheck = true;
|
||||
private boolean objectCheck = true;
|
||||
private boolean variantCheck = true;
|
||||
private boolean schemaCheck = true;
|
||||
private boolean tableCheck = true;
|
||||
private boolean functionCheck = true;
|
||||
private boolean objectCheck = true;
|
||||
private boolean variantCheck = true;
|
||||
|
||||
private boolean mustParameterized = false;
|
||||
private boolean mustParameterized = false;
|
||||
|
||||
private boolean allowDoPrivileged = false;
|
||||
private boolean allowDoPrivileged = false;
|
||||
|
||||
protected final Set<String> permitFunctions = new HashSet<String>();
|
||||
protected final Set<String> permitTables = new HashSet<String>();
|
||||
protected final Set<String> permitSchemas = new HashSet<String>();
|
||||
protected final Set<String> permitVariants = new HashSet<String>();
|
||||
protected final Set<String> permitObjects = new HashSet<String>();
|
||||
protected final Set<String> permitFunctions = new HashSet<String>();
|
||||
protected final Set<String> permitTables = new HashSet<String>();
|
||||
protected final Set<String> permitSchemas = new HashSet<String>();
|
||||
protected final Set<String> permitVariants = new HashSet<String>();
|
||||
protected final Set<String> permitObjects = new HashSet<String>();
|
||||
|
||||
protected final Set<String> readOnlyTables = new HashSet<String>();
|
||||
protected final Set<String> readOnlyTables = new HashSet<String>();
|
||||
|
||||
private String dir;
|
||||
private String dir;
|
||||
|
||||
private boolean inited;
|
||||
private boolean inited;
|
||||
|
||||
private String tenantTablePattern;
|
||||
private String tenantColumn;
|
||||
private String tenantTablePattern;
|
||||
private String tenantColumn;
|
||||
|
||||
public WallConfig() {
|
||||
private boolean wrapAllow = false;
|
||||
|
||||
}
|
||||
public WallConfig(){
|
||||
|
||||
public String getTenantTablePattern() {
|
||||
return tenantTablePattern;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTenantTablePattern(String tenantTablePattern) {
|
||||
this.tenantTablePattern = tenantTablePattern;
|
||||
}
|
||||
public String getTenantTablePattern() {
|
||||
return tenantTablePattern;
|
||||
}
|
||||
|
||||
public String getTenantColumn() {
|
||||
return tenantColumn;
|
||||
}
|
||||
public void setTenantTablePattern(String tenantTablePattern) {
|
||||
this.tenantTablePattern = tenantTablePattern;
|
||||
}
|
||||
|
||||
public void setTenantColumn(String tenantColumn) {
|
||||
this.tenantColumn = tenantColumn;
|
||||
}
|
||||
public String getTenantColumn() {
|
||||
return tenantColumn;
|
||||
}
|
||||
|
||||
public boolean isAllowDoPrivileged() {
|
||||
return allowDoPrivileged;
|
||||
}
|
||||
public void setTenantColumn(String tenantColumn) {
|
||||
this.tenantColumn = tenantColumn;
|
||||
}
|
||||
|
||||
public void setAllowDoPrivileged(boolean allowDoPrivileged) {
|
||||
this.allowDoPrivileged = allowDoPrivileged;
|
||||
}
|
||||
public boolean isWrapAllow() {
|
||||
return wrapAllow;
|
||||
}
|
||||
|
||||
public boolean isInited() {
|
||||
return inited;
|
||||
}
|
||||
public void setWrapAllow(boolean wrapAllow) {
|
||||
this.wrapAllow = wrapAllow;
|
||||
}
|
||||
|
||||
public WallConfig(String dir) {
|
||||
this.dir = dir;
|
||||
this.init();
|
||||
}
|
||||
public boolean isAllowDoPrivileged() {
|
||||
return allowDoPrivileged;
|
||||
}
|
||||
|
||||
public String getDir() {
|
||||
return dir;
|
||||
}
|
||||
public void setAllowDoPrivileged(boolean allowDoPrivileged) {
|
||||
this.allowDoPrivileged = allowDoPrivileged;
|
||||
}
|
||||
|
||||
public void setDir(String dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
public boolean isInited() {
|
||||
return inited;
|
||||
}
|
||||
|
||||
public final void init() {
|
||||
loadConfig(dir);
|
||||
}
|
||||
public WallConfig(String dir){
|
||||
this.dir = dir;
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void loadConfig(String dir) {
|
||||
if (dir.endsWith("/")) {
|
||||
dir = dir.substring(0, dir.length() - 1);
|
||||
}
|
||||
public String getDir() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
loadResource(this.permitVariants, dir + "/permit-variant.txt");
|
||||
loadResource(this.permitSchemas, dir + "/permit-schema.txt");
|
||||
loadResource(this.permitFunctions, dir + "/permit-function.txt");
|
||||
loadResource(this.permitTables, dir + "/permit-table.txt");
|
||||
loadResource(this.permitObjects, dir + "/permit-object.txt");
|
||||
loadResource(this.readOnlyTables, dir + "/readonly-table.txt");
|
||||
}
|
||||
public void setDir(String dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
public boolean isNoneBaseStatementAllow() {
|
||||
return noneBaseStatementAllow;
|
||||
}
|
||||
public final void init() {
|
||||
loadConfig(dir);
|
||||
}
|
||||
|
||||
public void setNoneBaseStatementAllow(boolean noneBaseStatementAllow) {
|
||||
this.noneBaseStatementAllow = noneBaseStatementAllow;
|
||||
}
|
||||
public void loadConfig(String dir) {
|
||||
if (dir.endsWith("/")) {
|
||||
dir = dir.substring(0, dir.length() - 1);
|
||||
}
|
||||
|
||||
public boolean isTruncateAllow() {
|
||||
return truncateAllow;
|
||||
}
|
||||
loadResource(this.permitVariants, dir + "/permit-variant.txt");
|
||||
loadResource(this.permitSchemas, dir + "/permit-schema.txt");
|
||||
loadResource(this.permitFunctions, dir + "/permit-function.txt");
|
||||
loadResource(this.permitTables, dir + "/permit-table.txt");
|
||||
loadResource(this.permitObjects, dir + "/permit-object.txt");
|
||||
loadResource(this.readOnlyTables, dir + "/readonly-table.txt");
|
||||
}
|
||||
|
||||
public void setTruncateAllow(boolean truncateAllow) {
|
||||
this.truncateAllow = truncateAllow;
|
||||
}
|
||||
public boolean isNoneBaseStatementAllow() {
|
||||
return noneBaseStatementAllow;
|
||||
}
|
||||
|
||||
public boolean isSelelctAllow() {
|
||||
return selelctAllow;
|
||||
}
|
||||
public void setNoneBaseStatementAllow(boolean noneBaseStatementAllow) {
|
||||
this.noneBaseStatementAllow = noneBaseStatementAllow;
|
||||
}
|
||||
|
||||
public void setSelelctAllow(boolean selelctAllow) {
|
||||
this.selelctAllow = selelctAllow;
|
||||
}
|
||||
public boolean isTruncateAllow() {
|
||||
return truncateAllow;
|
||||
}
|
||||
|
||||
public boolean isSelectIntoAllow() {
|
||||
return selectIntoAllow;
|
||||
}
|
||||
public void setTruncateAllow(boolean truncateAllow) {
|
||||
this.truncateAllow = truncateAllow;
|
||||
}
|
||||
|
||||
public void setSelectIntoAllow(boolean selectIntoAllow) {
|
||||
this.selectIntoAllow = selectIntoAllow;
|
||||
}
|
||||
public boolean isSelelctAllow() {
|
||||
return selelctAllow;
|
||||
}
|
||||
|
||||
public boolean isSelectIntoOutfileAllow() {
|
||||
return selectIntoOutfileAllow;
|
||||
}
|
||||
public void setSelelctAllow(boolean selelctAllow) {
|
||||
this.selelctAllow = selelctAllow;
|
||||
}
|
||||
|
||||
public void setSelectIntoOutfileAllow(boolean selectIntoOutfileAllow) {
|
||||
this.selectIntoOutfileAllow = selectIntoOutfileAllow;
|
||||
}
|
||||
public boolean isSelectIntoAllow() {
|
||||
return selectIntoAllow;
|
||||
}
|
||||
|
||||
public boolean isSelectUnionCheck() {
|
||||
return selectUnionCheck;
|
||||
}
|
||||
|
||||
public void setSelectUnionCheck(boolean selectUnionCheck) {
|
||||
this.selectUnionCheck = selectUnionCheck;
|
||||
}
|
||||
|
||||
public boolean isSelectWhereAlwayTrueCheck() {
|
||||
return selectWhereAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public void setSelectWhereAlwayTrueCheck(boolean selectWhereAlwayTrueCheck) {
|
||||
this.selectWhereAlwayTrueCheck = selectWhereAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public boolean isSelectHavingAlwayTrueCheck() {
|
||||
return selectHavingAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public void setSelectHavingAlwayTrueCheck(boolean selectHavingAlwayTrueCheck) {
|
||||
this.selectHavingAlwayTrueCheck = selectHavingAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public boolean isDeleteAllow() {
|
||||
return deleteAllow;
|
||||
}
|
||||
|
||||
public void setDeleteAllow(boolean deleteAllow) {
|
||||
this.deleteAllow = deleteAllow;
|
||||
}
|
||||
|
||||
public boolean isDeleteWhereAlwayTrueCheck() {
|
||||
return deleteWhereAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public void setDeleteWhereAlwayTrueCheck(boolean deleteWhereAlwayTrueCheck) {
|
||||
this.deleteWhereAlwayTrueCheck = deleteWhereAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public boolean isUpdateAllow() {
|
||||
return updateAllow;
|
||||
}
|
||||
|
||||
public void setUpdateAllow(boolean updateAllow) {
|
||||
this.updateAllow = updateAllow;
|
||||
}
|
||||
|
||||
public boolean isUpdateWhereAlayTrueCheck() {
|
||||
return updateWhereAlayTrueCheck;
|
||||
}
|
||||
public void setSelectIntoAllow(boolean selectIntoAllow) {
|
||||
this.selectIntoAllow = selectIntoAllow;
|
||||
}
|
||||
|
||||
public void setUpdateWhereAlayTrueCheck(boolean updateWhereAlayTrueCheck) {
|
||||
this.updateWhereAlayTrueCheck = updateWhereAlayTrueCheck;
|
||||
}
|
||||
public boolean isSelectIntoOutfileAllow() {
|
||||
return selectIntoOutfileAllow;
|
||||
}
|
||||
|
||||
public void setSelectIntoOutfileAllow(boolean selectIntoOutfileAllow) {
|
||||
this.selectIntoOutfileAllow = selectIntoOutfileAllow;
|
||||
}
|
||||
|
||||
public boolean isSelectUnionCheck() {
|
||||
return selectUnionCheck;
|
||||
}
|
||||
|
||||
public void setSelectUnionCheck(boolean selectUnionCheck) {
|
||||
this.selectUnionCheck = selectUnionCheck;
|
||||
}
|
||||
|
||||
public boolean isSelectWhereAlwayTrueCheck() {
|
||||
return selectWhereAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public void setSelectWhereAlwayTrueCheck(boolean selectWhereAlwayTrueCheck) {
|
||||
this.selectWhereAlwayTrueCheck = selectWhereAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public boolean isSelectHavingAlwayTrueCheck() {
|
||||
return selectHavingAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public void setSelectHavingAlwayTrueCheck(boolean selectHavingAlwayTrueCheck) {
|
||||
this.selectHavingAlwayTrueCheck = selectHavingAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public boolean isDeleteAllow() {
|
||||
return deleteAllow;
|
||||
}
|
||||
|
||||
public void setDeleteAllow(boolean deleteAllow) {
|
||||
this.deleteAllow = deleteAllow;
|
||||
}
|
||||
|
||||
public boolean isDeleteWhereAlwayTrueCheck() {
|
||||
return deleteWhereAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public void setDeleteWhereAlwayTrueCheck(boolean deleteWhereAlwayTrueCheck) {
|
||||
this.deleteWhereAlwayTrueCheck = deleteWhereAlwayTrueCheck;
|
||||
}
|
||||
|
||||
public boolean isUpdateAllow() {
|
||||
return updateAllow;
|
||||
}
|
||||
|
||||
public void setUpdateAllow(boolean updateAllow) {
|
||||
this.updateAllow = updateAllow;
|
||||
}
|
||||
|
||||
public boolean isUpdateWhereAlayTrueCheck() {
|
||||
return updateWhereAlayTrueCheck;
|
||||
}
|
||||
|
||||
public boolean isInsertAllow() {
|
||||
return insertAllow;
|
||||
}
|
||||
public void setUpdateWhereAlayTrueCheck(boolean updateWhereAlayTrueCheck) {
|
||||
this.updateWhereAlayTrueCheck = updateWhereAlayTrueCheck;
|
||||
}
|
||||
|
||||
public void setInsertAllow(boolean insertAllow) {
|
||||
this.insertAllow = insertAllow;
|
||||
}
|
||||
public boolean isInsertAllow() {
|
||||
return insertAllow;
|
||||
}
|
||||
|
||||
public boolean isMergeAllow() {
|
||||
return mergeAllow;
|
||||
}
|
||||
public void setInsertAllow(boolean insertAllow) {
|
||||
this.insertAllow = insertAllow;
|
||||
}
|
||||
|
||||
public void setMergeAllow(boolean mergeAllow) {
|
||||
this.mergeAllow = mergeAllow;
|
||||
}
|
||||
public boolean isMergeAllow() {
|
||||
return mergeAllow;
|
||||
}
|
||||
|
||||
public boolean isMultiStatementAllow() {
|
||||
return multiStatementAllow;
|
||||
}
|
||||
public void setMergeAllow(boolean mergeAllow) {
|
||||
this.mergeAllow = mergeAllow;
|
||||
}
|
||||
|
||||
public void setMultiStatementAllow(boolean multiStatementAllow) {
|
||||
this.multiStatementAllow = multiStatementAllow;
|
||||
}
|
||||
public boolean isMultiStatementAllow() {
|
||||
return multiStatementAllow;
|
||||
}
|
||||
|
||||
public boolean isSchemaCheck() {
|
||||
return schemaCheck;
|
||||
}
|
||||
public void setMultiStatementAllow(boolean multiStatementAllow) {
|
||||
this.multiStatementAllow = multiStatementAllow;
|
||||
}
|
||||
|
||||
public void setSchemaCheck(boolean schemaCheck) {
|
||||
this.schemaCheck = schemaCheck;
|
||||
}
|
||||
public boolean isSchemaCheck() {
|
||||
return schemaCheck;
|
||||
}
|
||||
|
||||
public boolean isTableCheck() {
|
||||
return tableCheck;
|
||||
}
|
||||
public void setSchemaCheck(boolean schemaCheck) {
|
||||
this.schemaCheck = schemaCheck;
|
||||
}
|
||||
|
||||
public void setTableCheck(boolean tableCheck) {
|
||||
this.tableCheck = tableCheck;
|
||||
}
|
||||
public boolean isTableCheck() {
|
||||
return tableCheck;
|
||||
}
|
||||
|
||||
public boolean isFunctionCheck() {
|
||||
return functionCheck;
|
||||
}
|
||||
public void setTableCheck(boolean tableCheck) {
|
||||
this.tableCheck = tableCheck;
|
||||
}
|
||||
|
||||
public void setFunctionCheck(boolean functionCheck) {
|
||||
this.functionCheck = functionCheck;
|
||||
}
|
||||
public boolean isFunctionCheck() {
|
||||
return functionCheck;
|
||||
}
|
||||
|
||||
public boolean isVariantCheck() {
|
||||
return variantCheck;
|
||||
}
|
||||
public void setFunctionCheck(boolean functionCheck) {
|
||||
this.functionCheck = functionCheck;
|
||||
}
|
||||
|
||||
public void setVariantCheck(boolean variantCheck) {
|
||||
this.variantCheck = variantCheck;
|
||||
}
|
||||
public boolean isVariantCheck() {
|
||||
return variantCheck;
|
||||
}
|
||||
|
||||
public boolean isObjectCheck() {
|
||||
return objectCheck;
|
||||
}
|
||||
public void setVariantCheck(boolean variantCheck) {
|
||||
this.variantCheck = variantCheck;
|
||||
}
|
||||
|
||||
public void setObjectCheck(boolean objectCheck) {
|
||||
this.objectCheck = objectCheck;
|
||||
}
|
||||
public boolean isObjectCheck() {
|
||||
return objectCheck;
|
||||
}
|
||||
|
||||
// ///////////////////
|
||||
public void setObjectCheck(boolean objectCheck) {
|
||||
this.objectCheck = objectCheck;
|
||||
}
|
||||
|
||||
public boolean isCommentAllow() {
|
||||
return commentAllow;
|
||||
}
|
||||
// ///////////////////
|
||||
|
||||
public void setCommentAllow(boolean commentAllow) {
|
||||
this.commentAllow = commentAllow;
|
||||
}
|
||||
public boolean isCommentAllow() {
|
||||
return commentAllow;
|
||||
}
|
||||
|
||||
public Set<String> getPermitFunctions() {
|
||||
return permitFunctions;
|
||||
}
|
||||
public void setCommentAllow(boolean commentAllow) {
|
||||
this.commentAllow = commentAllow;
|
||||
}
|
||||
|
||||
public Set<String> getPermitTables() {
|
||||
return permitTables;
|
||||
}
|
||||
public Set<String> getPermitFunctions() {
|
||||
return permitFunctions;
|
||||
}
|
||||
|
||||
public Set<String> getPermitSchemas() {
|
||||
return permitSchemas;
|
||||
}
|
||||
public Set<String> getPermitTables() {
|
||||
return permitTables;
|
||||
}
|
||||
|
||||
public Set<String> getPermitVariants() {
|
||||
return permitVariants;
|
||||
}
|
||||
public Set<String> getPermitSchemas() {
|
||||
return permitSchemas;
|
||||
}
|
||||
|
||||
public Set<String> getPermitObjects() {
|
||||
return permitObjects;
|
||||
}
|
||||
public Set<String> getPermitVariants() {
|
||||
return permitVariants;
|
||||
}
|
||||
|
||||
public Set<String> getReadOnlyTables() {
|
||||
return readOnlyTables;
|
||||
}
|
||||
public Set<String> getPermitObjects() {
|
||||
return permitObjects;
|
||||
}
|
||||
|
||||
public boolean isMustParameterized() {
|
||||
return mustParameterized;
|
||||
}
|
||||
public Set<String> getReadOnlyTables() {
|
||||
return readOnlyTables;
|
||||
}
|
||||
|
||||
public void setMustParameterized(boolean mustParameterized) {
|
||||
this.mustParameterized = mustParameterized;
|
||||
}
|
||||
public boolean isMustParameterized() {
|
||||
return mustParameterized;
|
||||
}
|
||||
|
||||
public boolean isPermitObjects(String name) {
|
||||
if (!objectCheck) {
|
||||
return false;
|
||||
}
|
||||
public void setMustParameterized(boolean mustParameterized) {
|
||||
this.mustParameterized = mustParameterized;
|
||||
}
|
||||
|
||||
name = WallVisitorUtils.form(name);
|
||||
return permitObjects.contains(name);
|
||||
}
|
||||
public boolean isPermitObjects(String name) {
|
||||
if (!objectCheck) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPermitSchema(String name) {
|
||||
if (!schemaCheck) {
|
||||
return false;
|
||||
}
|
||||
name = WallVisitorUtils.form(name);
|
||||
return permitObjects.contains(name);
|
||||
}
|
||||
|
||||
name = WallVisitorUtils.form(name);
|
||||
return this.permitSchemas.contains(name);
|
||||
}
|
||||
public boolean isPermitSchema(String name) {
|
||||
if (!schemaCheck) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPermitFunction(String name) {
|
||||
if (!functionCheck) {
|
||||
return false;
|
||||
}
|
||||
|
||||
name = WallVisitorUtils.form(name);
|
||||
return this.permitFunctions.contains(name);
|
||||
}
|
||||
|
||||
public boolean isCallAllow() {
|
||||
return callAllow;
|
||||
}
|
||||
|
||||
public void setCallAllow(boolean callAllow) {
|
||||
this.callAllow = callAllow;
|
||||
}
|
||||
name = WallVisitorUtils.form(name);
|
||||
return this.permitSchemas.contains(name);
|
||||
}
|
||||
|
||||
public boolean isPermitFunction(String name) {
|
||||
if (!functionCheck) {
|
||||
return false;
|
||||
}
|
||||
|
||||
name = WallVisitorUtils.form(name);
|
||||
return this.permitFunctions.contains(name);
|
||||
}
|
||||
|
||||
public boolean isCallAllow() {
|
||||
return callAllow;
|
||||
}
|
||||
|
||||
public void setCallAllow(boolean callAllow) {
|
||||
this.callAllow = callAllow;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.alibaba.druid.wall;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Wrapper;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -309,5 +310,20 @@ public class WallFilter extends FilterAdapter implements WallFilterMBean {
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrapperFor(FilterChain chain, Wrapper wrapper, Class<?> iface) throws SQLException {
|
||||
if (!this.provider.getConfig().isWrapAllow()) {
|
||||
return false;
|
||||
}
|
||||
return chain.isWrapperFor(wrapper, iface);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(FilterChain chain, Wrapper wrapper, Class<T> iface) throws SQLException {
|
||||
if (!this.provider.getConfig().isWrapAllow()) {
|
||||
return null;
|
||||
}
|
||||
return chain.unwrap(wrapper, iface);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user