From d5ce3cd6e349975a4eb10ddea33624e3641f9ebe Mon Sep 17 00:00:00 2001 From: abel Date: Mon, 21 Jan 2019 17:37:33 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-13094=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=EF=BC=8C=E9=80=89=E9=A1=B9=E4=B8=AD=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=AE=BE=E7=BD=AE=E6=98=BE=E7=A4=BAoracle=E6=89=80?= =?UTF-8?q?=E6=9C=89=E8=A1=A8=EF=BC=8C=E6=9C=89=E4=B8=80=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=B8=8D=E8=B5=B0=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/ilist/TableViewList.java | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index 0fd211adfe..658867f324 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/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.data.core.DataCoreUtils; 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.operator.DataOperator; 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.file.ConnectionConfig; import com.fr.general.ComparatorUtils; - import com.fr.stable.StringUtils; import javax.swing.*; @@ -138,17 +135,15 @@ public class TableViewList extends UIList { String[] schemas = DataCoreUtils.getDatabaseSchema(datasource); searchFilter = searchFilter.toLowerCase(); - - boolean isOracle = DataOperator.getInstance().isOracle(datasource); boolean isOracleSystemSpace = DesignerEnvManager.getEnvManager().isOracleSystemSpace(); // oracleb不勾选显示所有表,则只显示用户下的(包括存储过程和table表) if (isOracle && !isOracleSystemSpace) { - java.sql.Connection connection = datasource.createConnection(); - OracleDialect orcDialect = (OracleDialect)DialectFactory.generateDialect(connection); - schemas = new String[]{orcDialect.getOracleCurrentUserSchema(connection)}; + String[] userSchemas = DataOperator.getInstance().getOracleConnectionSchemas(datasource); + if (userSchemas.length > 0) { + schemas = userSchemas; + } } - if (typesFilter.length == 1 && ComparatorUtils.equals(typesFilter[0], TableProcedure.PROCEDURE)) { return processStoreProcedure(defaultListModel, schemas, datasource, isOracle, searchFilter); } else { @@ -182,7 +177,7 @@ public class TableViewList extends UIList { if (!isOracle) { String schema = null; for (String type : typesFilter) { - //非oracle数据库,默认都是显示所有表的,参数为true + //非oracle数据库,默认都是显示所有表的,参数为true TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, true); for (int i = 0; i < sqlTables.length; i++) { if (isBlank || sqlTables[i].getName().toLowerCase().indexOf(searchFilter) != -1) { @@ -192,17 +187,17 @@ public class TableViewList extends UIList { } } else { for (String type : typesFilter) { - for (String schema : schemas) { - TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, isOracleSystemSpace); - // oracle的表名加上模式 - for (int i = 0; i < sqlTables.length; i++) { - TableProcedure ta = sqlTables[i]; - String name = ta.getSchema() + '.' + ta.getName(); - if (isBlank || name.toLowerCase().indexOf(searchFilter) != -1) { - defaultListModel.addElement(sqlTables[i]); - } - } - } + for (String schema : schemas) { + TableProcedure[] sqlTables = DataCoreUtils.getTables(datasource, type, schema, isOracleSystemSpace); + // oracle的表名加上模式 + for (int i = 0; i < sqlTables.length; i++) { + TableProcedure ta = sqlTables[i]; + String name = ta.getSchema() + '.' + ta.getName(); + if (isBlank || name.toLowerCase().indexOf(searchFilter) != -1) { + defaultListModel.addElement(sqlTables[i]); + } + } + } } } return defaultListModel;