Skip to content

Instantly share code, notes, and snippets.

@corneliouzbett
Created May 1, 2019 09:08
Show Gist options
  • Save corneliouzbett/db9df6b7d606b76cc18796606b2d1af1 to your computer and use it in GitHub Desktop.
Save corneliouzbett/db9df6b7d606b76cc18796606b2d1af1 to your computer and use it in GitHub Desktop.
private static Table createUniqueTable(Database db, String name,
List<ColumnBuilder> columns,
ResultSetMetaData md,
ImportFilter filter)
throws IOException, SQLException
{
// otherwise, find unique name and create new table
String baseName = name;
int counter = 2;
while(db.getTable(name) != null) {
name = baseName + (counter++);
}
return new TableBuilder(name)
.addColumns(filter.filterColumns(columns, md))
.toTable(db);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment