Search in sources :

Example 1 with DatabaseItemTree

use of com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree in project Gargoyle by callakrsos.

the class PostgreSqlPane method apply.

@Override
public TreeItem<DatabaseItemTree<String>> apply(String t, Supplier<Connection> conSupplier) {
    try {
        DatabaseItemTree<String> databaseItemTree = new PostgreDatabaseItemTree("databases", conSupplier);
        TreeItem<DatabaseItemTree<String>> createNode = new DatabaseTreeNode().createNode(databaseItemTree);
        return createNode;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : PostgreDatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.postgre.PostgreDatabaseItemTree) PostgreDatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.postgre.PostgreDatabaseItemTree) DatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree) DatabaseTreeNode(com.kyj.fx.voeditor.visual.component.sql.dbtree.DatabaseTreeNode)

Example 2 with DatabaseItemTree

use of com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree in project Gargoyle by callakrsos.

the class MysqlPane method showEditableDataAction.

/**
	 * @작성자 : KYJ
	 * @작성일 : 2016. 11. 25.
	 */
@Override
public void showEditableDataAction() {
    // Default TableName
    TreeItem<DatabaseItemTree<String>> selectedItem = getSchemaTree().getSelectionModel().getSelectedItem();
    if (null != selectedItem) {
        DatabaseItemTree<String> value = selectedItem.getValue();
        if (value instanceof TableItemTree) {
            @SuppressWarnings("rawtypes") TableItemTree tableItemTree = (TableItemTree) value;
            String schemaName = tableItemTree.getParent().getName();
            String tableName = tableItemTree.getName();
            String sql = String.format("edit `%s`.%s", schemaName, tableName);
            execiteEdit(sql);
        }
    }
}
Also used : TableItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.TableItemTree) MySQLDatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.mysql.MySQLDatabaseItemTree) DatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree)

Example 3 with DatabaseItemTree

use of com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree in project Gargoyle by callakrsos.

the class MysqlPane method apply.

@Override
public TreeItem<DatabaseItemTree<String>> apply(String t, Supplier<Connection> conSupplier) {
    try {
        DatabaseItemTree<String> databaseItemTree = new MySQLDatabaseItemTree("databases", conSupplier);
        TreeItem<DatabaseItemTree<String>> createNode = new DatabaseTreeNode().createNode(databaseItemTree);
        return createNode;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : MySQLDatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.mysql.MySQLDatabaseItemTree) MySQLDatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.mysql.MySQLDatabaseItemTree) DatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree) DatabaseTreeNode(com.kyj.fx.voeditor.visual.component.sql.dbtree.DatabaseTreeNode)

Example 4 with DatabaseItemTree

use of com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree in project Gargoyle by callakrsos.

the class OracleSqlPane method apply.

@Override
public TreeItem<DatabaseItemTree<String>> apply(String t, Supplier<Connection> conSupplier) {
    try {
        DatabaseItemTree<String> databaseItemTree = new OracleDatabaseItemTree("databases", conSupplier);
        TreeItem<DatabaseItemTree<String>> createNode = new DatabaseTreeNode().createNode(databaseItemTree);
        return createNode;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : OracleDatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.oracle.OracleDatabaseItemTree) DatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree) OracleDatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.oracle.OracleDatabaseItemTree) DatabaseTreeNode(com.kyj.fx.voeditor.visual.component.sql.dbtree.DatabaseTreeNode)

Example 5 with DatabaseItemTree

use of com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree in project Gargoyle by callakrsos.

the class SqliteSchemaItemTree method applyChildren.

/**
	 * 커넥션으로부터 스키마 정보 출력
	 */
@Override
public ObservableList<TreeItem<DatabaseItemTree<String>>> applyChildren(Connection con, String... args) throws Exception {
    DatabaseMetaData metaData = con.getMetaData();
    ResultSet tables = metaData.getTables(null, null, "%", null);
    ObservableList<TreeItem<DatabaseItemTree<String>>> observableArrayList = FXCollections.observableArrayList();
    while (tables.next()) {
        String tableType = tables.getString(4);
        if ("TABLE".equals(tableType)) {
            LOGGER.debug("TABLE_CAT: {} TABLE_SCHEM:  {}  TABLE_NAME : {} TABLE_TYPE : {} ", tables.getString(1), tables.getString(2), tables.getString(3), tableType);
            SqliteTableItemTree mysqlSchemaItemTree = new SqliteTableItemTree(this, tables.getString(3));
            TreeItem<DatabaseItemTree<String>> treeItem = new TreeItem<>(mysqlSchemaItemTree);
            observableArrayList.add(treeItem);
        }
    }
    return observableArrayList;
}
Also used : TreeItem(javafx.scene.control.TreeItem) ResultSet(java.sql.ResultSet) DatabaseItemTree(com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree) DatabaseMetaData(java.sql.DatabaseMetaData)

Aggregations

DatabaseItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.DatabaseItemTree)11 DatabaseTreeNode (com.kyj.fx.voeditor.visual.component.sql.dbtree.DatabaseTreeNode)6 TreeItem (javafx.scene.control.TreeItem)5 DatabaseMetaData (java.sql.DatabaseMetaData)3 ResultSet (java.sql.ResultSet)3 MySQLDatabaseItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.mysql.MySQLDatabaseItemTree)2 PostgreDatabaseItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.postgre.PostgreDatabaseItemTree)2 JsonElement (com.google.gson.JsonElement)1 H2DatabaseItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.H2.H2DatabaseItemTree)1 ColumnItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.ColumnItemTree)1 TableItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.commons.TableItemTree)1 OracleDatabaseItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.oracle.OracleDatabaseItemTree)1 PostgreTableItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.postgre.PostgreTableItemTree)1 SqliteColumnItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.sqlite.SqliteColumnItemTree)1 SqliteDatabaseItemTree (com.kyj.fx.voeditor.visual.component.sql.dbtree.sqlite.SqliteDatabaseItemTree)1 SaveSQLFileFunction (com.kyj.fx.voeditor.visual.component.sql.functions.SaveSQLFileFunction)1 SqlKeywords (com.kyj.fx.voeditor.visual.component.text.SqlKeywords)1 GargoyleConnectionFailException (com.kyj.fx.voeditor.visual.exceptions.GargoyleConnectionFailException)1 ResourceLoader (com.kyj.fx.voeditor.visual.momory.ResourceLoader)1 DbUtil (com.kyj.fx.voeditor.visual.util.DbUtil)1