Exemple #1
0
  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);
    }
  }
Exemple #2
0
 private void appendColumn(BaseColumn column, boolean includeName, boolean includeType) {
   if (includeName) {
     append(SQLStringVisitor.escapeSinglePart(column.getName()));
   }
   if (includeType) {
     Datatype datatype = column.getDatatype();
     String runtimeTypeName = column.getRuntimeType();
     if (datatype != null) {
       runtimeTypeName = datatype.getRuntimeTypeName();
     }
     if (includeName) {
       append(SPACE);
     }
     append(runtimeTypeName);
     if (LENGTH_DATATYPES.contains(runtimeTypeName)) {
       if (column.getLength() != 0
           && (datatype == null || column.getLength() != datatype.getLength())) {
         append(LPAREN).append(column.getLength()).append(RPAREN);
       }
     } else if (PRECISION_DATATYPES.contains(runtimeTypeName)
         && !column.isDefaultPrecisionScale()) {
       append(LPAREN).append(column.getPrecision());
       if (column.getScale() != 0) {
         append(COMMA).append(column.getScale());
       }
       append(RPAREN);
     }
     if (datatype != null) {
       for (int dims = column.getArrayDimensions(); dims > 0; dims--) {
         append(Tokens.LSBRACE).append(Tokens.RSBRACE);
       }
     }
     if (column.getNullType() == NullType.No_Nulls) {
       append(SPACE).append(NOT_NULL);
     }
   }
 }