in fastmodel-transform/fastmodel-transform-oceanbase/src/main/java/com/aliyun/fastmodel/transform/oceanbase/format/OceanBaseMysqlOutVisitor.java [181:240]
protected String formatProperty(List<Property> properties) {
if (properties == null) {
return StringUtils.EMPTY;
}
StringBuilder stringBuilder = new StringBuilder();
for (Property property : properties) {
String name = property.getName();
ExtensionPropertyKey byValue = ExtensionPropertyKey.getByValue(name);
if (byValue != null && !byValue.isSupportPrint()) {
continue;
}
if (StringUtils.equalsIgnoreCase(name, OceanBasePropertyKey.COMMENT.getValue())) {
continue;
}
if (StringUtils.equalsIgnoreCase(name, OceanBasePropertyKey.SORT_KEY.getValue())) {
stringBuilder.append(OceanBasePropertyKey.SORT_KEY.getValue()).append("(");
stringBuilder.append(property.getValue());
stringBuilder.append(")");
stringBuilder.append(StringUtils.LF);
continue;
}
OceanBasePropertyKey oceanBasePropertyKey = OceanBasePropertyKey.getByValue(name);
if (oceanBasePropertyKey == null) {
stringBuilder.append(name);
stringBuilder.append("=");
stringBuilder.append(formatStringLiteral(property.getValue()));
stringBuilder.append(StringUtils.LF);
continue;
}
if (!oceanBasePropertyKey.isSupportPrint()) {
continue;
}
if (StringUtils.equalsIgnoreCase(name, OceanBasePropertyKey.CHARSET_KEY.getValue())) {
stringBuilder.append("DEFAULT");
stringBuilder.append(" CHARSET ").append(property.getValue());
stringBuilder.append(StringUtils.LF);
continue;
}
if (StringUtils.equalsIgnoreCase(name, OceanBasePropertyKey.COLLATE.getValue())) {
stringBuilder.append("COLLATE ");
stringBuilder.append(property.getValue());
stringBuilder.append(StringUtils.LF);
continue;
}
PropertyValueType valueType = oceanBasePropertyKey.getValueType();
if (valueType == PropertyValueType.STRING_LITERAL) {
stringBuilder.append(name);
stringBuilder.append("=");
stringBuilder.append(formatStringLiteral(property.getValue()));
stringBuilder.append(StringUtils.LF);
} else {
stringBuilder.append(name);
stringBuilder.append("=");
stringBuilder.append(property.getValue());
stringBuilder.append(StringUtils.LF);
}
}
return stringBuilder.toString();
}