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

#3294 RSV dictionary read fix: include NULL values


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