Esempio n. 1
0
  /**
   * Delivers a list with {@link Field}'s for the given {@link Table}.
   *
   * @param table
   * @return
   */
  private List<Field> getFieldsForTable(Table table) {
    List<Field> fields = new ArrayList<Field>();

    try {
      DatabaseMetaData meta = getConnection().getMetaData();
      ResultSet columns = meta.getColumns(null, null, table.getName(), null);

      while (columns.next()) {
        Field field = new Field(columns.getString("COLUMN_NAME"), columns.getInt("DATA_TYPE"));
        fields.add(field);
      }
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return fields;
  }
Esempio n. 2
0
 @Override
 public String buildTableName(Table table) {
   return "[" + table.getSchema() + "].[" + table.getName() + "]";
 }