use of com.kyj.fx.voeditor.visual.component.sql.dbtree.sqlite.SqliteColumnItemTree in project Gargoyle by callakrsos.
the class H2TableItemTree method applyChildren.
// private static final int GETPRIMARY_KEY_SEQ = 5;
// private static final int GETPRIMARY_PRIMARYKEY_NAME = 6;
@Override
public ObservableList<TreeItem<DatabaseItemTree<String>>> applyChildren(Connection con, String... args) throws Exception {
DatabaseMetaData metaData = con.getMetaData();
ResultSet tables = metaData.getColumns(null, args[0], args[1], "%");
Set<String> primaryKeySet = toSet(metaData.getPrimaryKeys(null, args[0], args[1]), COLUMN_NAME);
ObservableList<TreeItem<DatabaseItemTree<String>>> observableArrayList = FXCollections.observableArrayList();
while (tables.next()) {
/*
* references
* http://docs.oracle.com/javase/6/docs/api/java/sql/ DatabaseMetaData.html#getTables%28java.lang.String,%20java.lang. String,%20java.lang.String,%20java.lang.String%5b%5d%29
*/
String columnName = tables.getString(COLUMN_NAME);
SqliteColumnItemTree coumnItem = new SqliteColumnItemTree(this, columnName);
coumnItem.setPrimaryKey(primaryKeySet.contains(columnName));
TreeItem<DatabaseItemTree<String>> treeItem = new TreeItem<>(coumnItem);
observableArrayList.add(treeItem);
}
return observableArrayList;
}
Aggregations