private void appendColumnOptions(BaseColumn column) { StringBuilder options = new StringBuilder(); addCommonOptions(options, column); if (!column.getDatatype().isBuiltin()) { addOption( options, UDT, column.getDatatype().getName() + "(" + column.getLength() + ", " + column.getPrecision() + ", " + column.getScale() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } if (column.getDatatype().getRadix() != 0 && column.getRadix() != column.getDatatype().getRadix()) { addOption(options, RADIX, column.getRadix()); } buildColumnOptions(column, options); if (options.length() != 0) { append(SPACE).append(OPTIONS).append(SPACE).append(LPAREN).append(options).append(RPAREN); } }
private void appendOptions(AbstractMetadataRecord record) { StringBuilder options = new StringBuilder(); addCommonOptions(options, record); buildOptions(record, options); if (options.length() != 0) { append(SPACE).append(OPTIONS).append(SPACE).append(LPAREN).append(options).append(RPAREN); } }
private void addOption(StringBuilder sb, String key, Object value) { if (sb.length() != 0) { sb.append(COMMA).append(SPACE); } if (value != null) { value = new Constant(value); } else { value = Constant.NULL_CONSTANT; } if (key != null && key.length() > 2 && key.charAt(0) == '{') { String origKey = key; int index = key.indexOf('}'); if (index > 1) { String uri = key.substring(1, index); key = key.substring(index + 1, key.length()); String prefix = BUILTIN_PREFIXES.get(uri); if ((prefix == null && usePrefixes) || createNS) { if (prefixMap == null) { prefixMap = new LinkedHashMap<String, String>(); } else { prefix = this.prefixMap.get(uri); } if (prefix == null) { prefix = "n" + this.prefixMap.size(); // $NON-NLS-1$ } this.prefixMap.put(uri, prefix); } if (prefix != null) { key = prefix + ":" + key; // $NON-NLS-1$ } else { key = origKey; } } } sb.append(SQLStringVisitor.escapeSinglePart(key)).append(SPACE).append(value); }