提交 ba3abad0 编写于 作者: S serge-rider

#3294 RSV dictionary read fix: include NULL values


Former-commit-id: 2093e2ce
上级 8ce1603b
...@@ -80,8 +80,8 @@ class GenericFilterValueEdit { ...@@ -80,8 +80,8 @@ class GenericFilterValueEdit {
private boolean isCheckedTable; private boolean isCheckedTable;
public static final int MAX_MULTI_VALUES = 1000; private static final int MAX_MULTI_VALUES = 1000;
public static final String MULTI_KEY_LABEL = "..."; private static final String MULTI_KEY_LABEL = "...";
GenericFilterValueEdit(@NotNull ResultSetViewer viewer, @NotNull DBDAttributeBinding attr, @NotNull ResultSetRow[] rows, @NotNull DBCLogicalOperator operator) { GenericFilterValueEdit(@NotNull ResultSetViewer viewer, @NotNull DBDAttributeBinding attr, @NotNull ResultSetRow[] rows, @NotNull DBCLogicalOperator operator) {
...@@ -126,15 +126,12 @@ class GenericFilterValueEdit { ...@@ -126,15 +126,12 @@ class GenericFilterValueEdit {
// Create filter text // Create filter text
final Text valueFilterText = new Text(composite, SWT.BORDER); final Text valueFilterText = new Text(composite, SWT.BORDER);
valueFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); valueFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
valueFilterText.addModifyListener(new ModifyListener() { valueFilterText.addModifyListener(e -> {
@Override filterPattern = valueFilterText.getText();
public void modifyText(ModifyEvent e) { if (filterPattern.isEmpty()) {
filterPattern = valueFilterText.getText(); filterPattern = null;
if (filterPattern.isEmpty()) {
filterPattern = null;
}
loadValues();
} }
loadValues();
}); });
return valueFilterText; return valueFilterText;
} }
...@@ -155,7 +152,7 @@ class GenericFilterValueEdit { ...@@ -155,7 +152,7 @@ class GenericFilterValueEdit {
} else if (attr.getEntityAttribute() instanceof DBSAttributeEnumerable) { } else if (attr.getEntityAttribute() instanceof DBSAttributeEnumerable) {
loadAttributeEnum((DBSAttributeEnumerable) attr.getEntityAttribute()); loadAttributeEnum((DBSAttributeEnumerable) attr.getEntityAttribute());
} else { } else {
loadMultiValueList(Collections.<DBDLabelValuePair>emptyList()); loadMultiValueList(Collections.emptyList());
} }
} }
...@@ -259,7 +256,9 @@ class GenericFilterValueEdit { ...@@ -259,7 +256,9 @@ class GenericFilterValueEdit {
} }
Collections.sort(sortedList); Collections.sort(sortedList);
if (hasNulls) { if (hasNulls) {
sortedList.add(0, new DBDLabelValuePair(DBValueFormatting.getDefaultValueDisplayString(null, DBDDisplayFormat.UI), null)); if (!rowData.containsKey(null)) {
sortedList.add(0, new DBDLabelValuePair(DBValueFormatting.getDefaultValueDisplayString(null, DBDDisplayFormat.UI), null));
}
} }
Set<Object> checkedValues = new HashSet<>(); Set<Object> checkedValues = new HashSet<>();
......
...@@ -57,7 +57,7 @@ public abstract class DBVUtils { ...@@ -57,7 +57,7 @@ public abstract class DBVUtils {
} }
@Nullable @Nullable
public static DBVTransformSettings getTransformSettings(@NotNull DBVEntityAttribute attribute, boolean create) { private static DBVTransformSettings getTransformSettings(@NotNull DBVEntityAttribute attribute, boolean create) {
if (attribute.getTransformSettings() != null) { if (attribute.getTransformSettings() != null) {
return attribute.getTransformSettings(); return attribute.getTransformSettings();
} else if (create) { } else if (create) {
...@@ -161,6 +161,7 @@ public abstract class DBVUtils { ...@@ -161,6 +161,7 @@ public abstract class DBVUtils {
for (DBCAttributeMetaData col : metaColumns) { for (DBCAttributeMetaData col : metaColumns) {
colHandlers.add(DBUtils.findValueHandler(session, col)); colHandlers.add(DBUtils.findValueHandler(session, col));
} }
boolean hasNulls = false;
// Extract enumeration values and (optionally) their descriptions // Extract enumeration values and (optionally) their descriptions
while (dbResult.nextRow()) { while (dbResult.nextRow()) {
// Check monitor // Check monitor
...@@ -169,19 +170,25 @@ public abstract class DBVUtils { ...@@ -169,19 +170,25 @@ public abstract class DBVUtils {
} }
// Get value and description // Get value and description
Object keyValue = valueHandler.fetchValueObject(session, dbResult, valueAttribute, 0); Object keyValue = valueHandler.fetchValueObject(session, dbResult, valueAttribute, 0);
if (keyValue == null) { if (DBUtils.isNullValue(keyValue)) {
continue; if (hasNulls) {
continue;
}
hasNulls = true;
} }
String keyLabel = valueHandler.getValueDisplayString(valueAttribute, keyValue, DBDDisplayFormat.NATIVE); String keyLabel;
if (metaColumns.size() > 1) { if (metaColumns.size() > 1) {
keyLabel = ""; StringBuilder keyLabel2 = new StringBuilder();
for (int i = 1; i < colHandlers.size(); i++) { for (int i = 1; i < colHandlers.size(); i++) {
Object descValue = colHandlers.get(i).fetchValueObject(session, dbResult, metaColumns.get(i), i); Object descValue = colHandlers.get(i).fetchValueObject(session, dbResult, metaColumns.get(i), i);
if (!keyLabel.isEmpty()) { if (keyLabel2.length() > 0) {
keyLabel += " "; keyLabel2.append(" ");
} }
keyLabel += colHandlers.get(i).getValueDisplayString(metaColumns.get(i), descValue, DBDDisplayFormat.NATIVE); keyLabel2.append(colHandlers.get(i).getValueDisplayString(metaColumns.get(i), descValue, DBDDisplayFormat.NATIVE));
} }
keyLabel = keyLabel2.toString();
} else {
keyLabel = valueHandler.getValueDisplayString(valueAttribute, keyValue, DBDDisplayFormat.NATIVE);
} }
values.add(new DBDLabelValuePair(keyLabel, keyValue)); values.add(new DBDLabelValuePair(keyLabel, keyValue));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册