Browse Source

REPORT-31879 gauss表的字段获取不到

bugfix/10.0
zack 5 years ago
parent
commit
43894e0d3f
  1. 32
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  2. 10
      designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java

32
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -1,10 +1,10 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.BaseUtils;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
import com.fr.data.core.db.dialect.Dialect;
import com.fr.data.core.db.dialect.DialectFactory; import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
@ -38,11 +38,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.JList; import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
@ -53,9 +49,7 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -455,6 +449,15 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
* @return 数据集数据 * @return 数据集数据
*/ */
public TableData createSelectTableData() { public TableData createSelectTableData() {
return createSelectTableData(new SelectSqlProcessor() {
@Override
public String createSelectSql(String schema, String tableName, Dialect dialect) {
return DataCoreUtils.createSelectSQL(schema, tableName, dialect);
}
});
}
public TableData createSelectTableData(SelectSqlProcessor sqlProcessor) {
DataBaseItems paras = this.updateBean(); DataBaseItems paras = this.updateBean();
boolean connect = false; boolean connect = false;
com.fr.data.impl.Connection database = DBUtils.checkDBConnection(paras.getDatabaseName()); com.fr.data.impl.Connection database = DBUtils.checkDBConnection(paras.getDatabaseName());
@ -477,11 +480,11 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
TableData tableData = null; TableData tableData = null;
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), tableData = new DBTableData(database, sqlProcessor.createSelectSql(paras.getSchemaName(), paras.getTableName(),
DialectFactory.getDialectByName(paras.getDatabaseName()))); DialectFactory.getDialectByName(paras.getDatabaseName())));
} else { } else {
try { try {
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); TableData tableDataLocal = new DBTableData(database, sqlProcessor.createSelectSql(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName())));
tableData = DataOperator.getInstance().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP, tableData = DataOperator.getInstance().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP,
DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow()); DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow());
} catch (Exception e) { } catch (Exception e) {
@ -591,6 +594,13 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}); });
} }
/**
* 数据集选择面板里的生成sql语句的接口
*/
public interface SelectSqlProcessor {
String createSelectSql(String schema, String tableName, Dialect dialect);
}
protected class StringUIComboBox extends UIComboBox { protected class StringUIComboBox extends UIComboBox {
private boolean refreshingModel = false; private boolean refreshingModel = false;

10
designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java

@ -2,7 +2,9 @@ package com.fr.design.present.dict;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.dialect.Dialect;
import com.fr.data.impl.DatabaseDictionary; import com.fr.data.impl.DatabaseDictionary;
import com.fr.data.impl.NameDatabaseConnection; import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
@ -23,7 +25,6 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -215,7 +216,12 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
* *
*/ */
public void dbChange() { public void dbChange() {
TableData tableData = this.chooseTable.createSelectTableData(); TableData tableData = this.chooseTable.createSelectTableData(new ChoosePane.SelectSqlProcessor() {
@Override
public String createSelectSql(String schema, String tableName, Dialect dialect) {
return DataCoreUtils.createColumnSelectSQL(schema, tableName, dialect);
}
});
String[] columnNames = DesignTableDataManager.getColumnNamesByTableData(tableData).toArray(new String[0]); String[] columnNames = DesignTableDataManager.getColumnNamesByTableData(tableData).toArray(new String[0]);
ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames); ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames);
columnNameEditor1.addItemListener(itemListener); columnNameEditor1.addItemListener(itemListener);

Loading…
Cancel
Save