提交 b3456315 编写于 作者: L LonwoLonwo

#4644 extra options added in table DDL

上级 5e0081d0
......@@ -129,7 +129,7 @@ public abstract class PostgreTableBase extends JDBCTable<PostgreDataSource, Post
return this.oid;
}
@Property(order = 90)
@Property(viewable = true, multiline = true, order = 90)
@Nullable
public String[] getRelOptions() {
return relOptions;
......
......@@ -30,6 +30,7 @@ import org.jkiss.utils.ArrayUtils;
import org.jkiss.utils.CommonUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -394,8 +395,27 @@ public abstract class PostgreServerExtensionBase implements PostgreServerExtensi
public String createWithClause(PostgreTableRegular table, PostgreTableBase tableBase) {
StringBuilder withClauseBuilder = new StringBuilder();
if (table.getDataSource().getServerType().supportsOids() && table.isHasOids() && table.getDataSource().getServerType().supportsHasOidsColumn()) {
withClauseBuilder.append("\nWITH (\n\tOIDS=").append(table.isHasOids() ? "TRUE" : "FALSE");
boolean hasExtraOptions = dataSource.isServerVersionAtLeast(8, 2) && table.getRelOptions() != null;
boolean tableSupportOids = table.getDataSource().getServerType().supportsOids() && table.isHasOids() && table.getDataSource().getServerType().supportsHasOidsColumn();
List<String> extraOptions = new ArrayList<>();
if (tableSupportOids) {
extraOptions.add("OIDS=TRUE");
}
if (hasExtraOptions) {
extraOptions.addAll(Arrays.asList(table.getRelOptions()));
}
if (!CommonUtils.isEmpty(extraOptions)) {
withClauseBuilder.append("\nWITH (\n\t");
for (int i = 0; i < extraOptions.size(); i++) {
if (i == 0) {
withClauseBuilder.append(extraOptions.get(i));
} else {
withClauseBuilder.append(",\n\t").append(extraOptions.get(i));
}
}
withClauseBuilder.append("\n)");
}
......
......@@ -719,7 +719,9 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
}
private static boolean isTextPropertyType(Class<?> propertyType) {
return propertyType == null || CharSequence.class.isAssignableFrom(propertyType) || BeanUtils.isNumericType(propertyType);
return propertyType == null || CharSequence.class.isAssignableFrom(propertyType) ||
(propertyType.getComponentType() != null && CharSequence.class.isAssignableFrom(propertyType.getComponentType())) ||
BeanUtils.isNumericType(propertyType);
}
private List<DBPPropertyDescriptor> filterProperties(DBPPropertyDescriptor[] props) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册