Example #1
0
  private String buildFunctionOptions(FunctionMethod function) {
    StringBuilder options = new StringBuilder();
    addCommonOptions(options, function);

    if (function.getCategory() != null) {
      addOption(options, CATEGORY, function.getCategory());
    }

    if (!function.getDeterminism().equals(Determinism.DETERMINISTIC)) {
      addOption(options, DETERMINISM, function.getDeterminism().name());
    }

    if (function.getInvocationClass() != null) {
      addOption(options, JAVA_CLASS, function.getInvocationClass());
    }

    if (function.getInvocationMethod() != null) {
      addOption(options, JAVA_METHOD, function.getInvocationMethod());
    }

    if (!function.getProperties().isEmpty()) {
      for (String key : function.getProperties().keySet()) {
        addOption(options, key, function.getProperty(key, false));
      }
    }

    return options.toString();
  }
Example #2
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);
    }
  }
Example #3
0
  private String buildTableOptions(Table table) {
    StringBuilder options = new StringBuilder();
    addCommonOptions(options, table);

    if (table.isMaterialized()) {
      addOption(options, MATERIALIZED, table.isMaterialized());
      if (table.getMaterializedTable() != null) {
        addOption(options, MATERIALIZED_TABLE, table.getMaterializedTable().getName());
      }
    }
    if (table.supportsUpdate()) {
      addOption(options, UPDATABLE, table.supportsUpdate());
    }
    if (table.getCardinality() != -1) {
      if (table.getCardinality() != table.getCardinalityAsFloat()) {
        addOption(options, CARDINALITY, (long) table.getCardinalityAsFloat());
      } else {
        addOption(options, CARDINALITY, table.getCardinality());
      }
    }
    if (!table.getProperties().isEmpty()) {
      for (String key : table.getProperties().keySet()) {
        addOption(options, key, table.getProperty(key, false));
      }
    }
    return options.toString();
  }
Example #4
0
 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);
   }
 }
Example #5
0
  private String buildProcedureOptions(Procedure procedure) {
    StringBuilder options = new StringBuilder();
    addCommonOptions(options, procedure);

    if (procedure.getUpdateCount() != Procedure.AUTO_UPDATECOUNT) {
      addOption(options, UPDATECOUNT, procedure.getUpdateCount());
    }

    if (!procedure.getProperties().isEmpty()) {
      for (String key : procedure.getProperties().keySet()) {
        addOption(options, key, procedure.getProperty(key, false));
      }
    }

    return options.toString();
  }