Browse Source

REPORT-13094 设计器远程,选项中没有设置显示oracle所有表,有一部分逻辑不走服务器

bugfix/10.0
abel 6 years ago
parent
commit
d5ce3cd6e3
  1. 37
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

37
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -4,8 +4,6 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.core.db.dialect.OracleDialect;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.operator.DataOperator; import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -13,7 +11,6 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.dnd.SerializableTransferable; import com.fr.design.mainframe.dnd.SerializableTransferable;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -138,17 +135,15 @@ public class TableViewList extends UIList {
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource); String[] schemas = DataCoreUtils.getDatabaseSchema(datasource);
searchFilter = searchFilter.toLowerCase(); searchFilter = searchFilter.toLowerCase();
boolean isOracle = DataOperator.getInstance().isOracle(datasource); boolean isOracle = DataOperator.getInstance().isOracle(datasource);
boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace(); boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace();
// oracleb不勾选显示所有表,则只显示用户下的(包括存储过程和table表) // oracleb不勾选显示所有表,则只显示用户下的(包括存储过程和table表)
if (isOracle && !isOracleSystemSpace) { if (isOracle && !isOracleSystemSpace) {
java.sql.Connection connection = datasource.createConnection(); String[] userSchemas = DataOperator.getInstance().getOracleConnectionSchemas(datasource);
OracleDialect orcDialect = (OracleDialect)DialectFactory.generateDialect(connection); if (userSchemas.length > 0) {
schemas = new String[]{orcDialect.getOracleCurrentUserSchema(connection)}; schemas = userSchemas;
}
} }
if (typesFilter.length == 1 && ComparatorUtils.equals(typesFilter[0], TableProcedure.PROCEDURE)) { if (typesFilter.length == 1 && ComparatorUtils.equals(typesFilter[0], TableProcedure.PROCEDURE)) {
return processStoreProcedure(defaultListModel, schemas, datasource, isOracle, searchFilter); return processStoreProcedure(defaultListModel, schemas, datasource, isOracle, searchFilter);
} else { } else {
@ -182,7 +177,7 @@ public class TableViewList extends UIList {
if (!isOracle) { if (!isOracle) {
String schema = null; String schema = null;
for (String type : typesFilter) { for (String type : typesFilter) {
//非oracle数据库,默认都是显示所有表的,参数为true //非oracle数据库,默认都是显示所有表的,参数为true
TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, true); TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, true);
for (int i = 0; i < sqlTables.length; i++) { for (int i = 0; i < sqlTables.length; i++) {
if (isBlank || sqlTables[i].getName().toLowerCase().indexOf(searchFilter) != -1) { if (isBlank || sqlTables[i].getName().toLowerCase().indexOf(searchFilter) != -1) {
@ -192,17 +187,17 @@ public class TableViewList extends UIList {
} }
} else { } else {
for (String type : typesFilter) { for (String type : typesFilter) {
for (String schema : schemas) { for (String schema : schemas) {
TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, isOracleSystemSpace); TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, isOracleSystemSpace);
// oracle的表名加上模式 // oracle的表名加上模式
for (int i = 0; i < sqlTables.length; i++) { for (int i = 0; i < sqlTables.length; i++) {
TableProcedure ta = sqlTables[i]; TableProcedure ta = sqlTables[i];
String name = ta.getSchema() + '.' + ta.getName(); String name = ta.getSchema() + '.' + ta.getName();
if (isBlank || name.toLowerCase().indexOf(searchFilter) != -1) { if (isBlank || name.toLowerCase().indexOf(searchFilter) != -1) {
defaultListModel.addElement(sqlTables[i]); defaultListModel.addElement(sqlTables[i]);
} }
} }
} }
} }
} }
return defaultListModel; return defaultListModel;

Loading…
Cancel
Save