📄 browsercontroller.java
字号:
return metaData.getSchemaName(); } /** * Propagates the call to the meta data object. */ protected List getCatalogSchemas(DatabaseConnection dc) { try { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getHostedCatalogSchemas(); } catch (DataSourceException e) { handleException(e); return null; } } /** * Propagates the call to the meta data object. */ protected String getDataSourceName(DatabaseConnection dc) { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getDataSourceName(); } /** * Propagates the call to the meta data object. */ protected Vector<String> getHostedCatalogs(DatabaseConnection dc) { try { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getHostedCatalogsVector(); } catch (DataSourceException e) { handleException(e); return new Vector(0); } } /** * Propagates the call to the meta data object. */ protected Vector<String> getHostedSchemas(DatabaseConnection dc) { try { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getHostedSchemasVector(); } catch (DataSourceException e) { handleException(e); return new Vector(0); } } /** * Propagates the call to the meta data object. */ protected Vector<String> getColumnNamesVector(DatabaseConnection dc, String table, String schema) { try { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getColumnNamesVector(table, schema); } catch (DataSourceException e) { handleException(e); return new Vector(0); } } /** * Propagates the call to the meta data object. */ protected Vector<String> getColumnNamesVector(String table, String schema) { return getColumnNamesVector(getDatabaseConnection(), table, schema); } /** * Propagates the call to the meta data object. */ protected Vector<String> getHostedSchemas() { return getHostedSchemas(getDatabaseConnection()); } /** * Propagates the call to the meta data object. */ protected Vector<String> getTables(String schema) { return getTables(getDatabaseConnection(), schema); } /** * Propagates the call to the meta data object. */ protected Vector<String> getTables(DatabaseConnection dc, String schema) { try { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getSchemaTables(schema); } catch (DataSourceException e) { handleException(e); return new Vector(0); } } /** * Propagates the call to the meta data object. */ protected String getCatalogName(DatabaseConnection dc) { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getCatalogName(); } /** * Propagates the call to the meta data object. */ protected String[] getDataTypesArray() { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return metaData.getDataTypesArray(); } catch (DataSourceException e) { handleException(e); return new String[0]; } } /** * Propagates the call to the meta data object. */ protected Map getColumnProperties(DatabaseConnection dc, String schema, String table, String column) { try { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getColumnProperties(schema, table, column); } catch (DataSourceException e) { handleException(e); return new Hashtable(0); } } /** * Propagates the call to the meta data object. */ protected DatabaseProcedure getProcedureColumns(DatabaseConnection dc, String catalog, String schema, String name) { try { checkMetaDataObject(); metaData.setDatabaseConnection(dc); return metaData.getProcedureColumns(catalog, schema, name); } catch (DataSourceException e) { handleException(e); return null; } } /** * Propagates the call to the meta data object. */ protected String[] getExportedKeyTables(String catalog, String schema, String name) { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return metaData.getExportedKeyTables( isUsingCatalogs() ? catalog : null, schema, name); } catch (DataSourceException e) { handleException(e); return new String[0]; } } /** * Propagates the call to the meta data object. */ protected String[] getImportedKeyTables(String catalog, String schema, String name) { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return metaData.getImportedKeyTables( isUsingCatalogs() ? catalog : null, schema, name); } catch (DataSourceException e) { handleException(e); return new String[0]; } } /** * Propagates the call to the meta object. */ protected ResultSet getTableMetaData(String catalog, String schema, String name) { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return metaData.getTableMetaData( isUsingCatalogs() ? catalog : null, schema, name); } catch (DataSourceException e) { handleException(e); return null; } } /** * Propagates the call to the meta data object. */ protected Vector getTableIndexes(String catalog, String schema, String name) { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return metaData.getTableIndexes( isUsingCatalogs() ? catalog : null, schema, name); } catch (DataSourceException e) { handleException(e); return new Vector(0); } } /** * Propagates the call to the meta data object. */ protected TablePrivilege[] getPrivileges(String catalog, String schema, String name) { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return metaData.getPrivileges( isUsingCatalogs() ? catalog : null, schema, name); } catch (DataSourceException e) { handleException(e); return new TablePrivilege[0]; } } protected ColumnData[] getColumnData(String catalog, String schema, String name) { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return metaData.getColumnMetaData( isUsingCatalogs() ? catalog : null, schema, name); } catch (DataSourceException e) { handleException(e); return new ColumnData[0]; } } /** * Recycles the specified connection object for the browser. * * @param dc - the connection to be recycled */ protected void recycleConnection(DatabaseConnection dc) { try { checkMetaDataObject(); metaData.recycleConnection(dc); } catch (DataSourceException e) { handleException(e); } } /** * Ensures the meta data object is initialised. */ private void checkMetaDataObject() { if (metaData == null) { metaData = new MetaDataValues(true); } } /** * Returns true if the currently selected connection is using * catalogs in meta data retrieval. * * @return true | false */ protected boolean isUsingCatalogs() { return treePanel.getSelectedMetaObject().isCatalogsInUse(); } /** * Retrieves the selected database connection properties object. */ protected DatabaseConnection getDatabaseConnection() { ConnectionObject object = treePanel.getSelectedMetaObject(); if (object != null) { return object.getDatabaseConnection(); } return null; } /** * Retrieves the table data row count for the specified table. * * @param schema - the schema name (may be null) * @param table - the table name * @return the data row count as a String or a formatted error message */ protected String getTableDataRowCount(String schema, String table) { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return String.valueOf(metaData.getTableDataRowCount(schema, table)); } catch (DataSourceException e) { return "Error: " + e.getMessage(); } } /** * Retrieves the data in its entirety from the specified table. * * @param schema - the schema name (may be null) * @param table - the table name * @return the table data */ public ResultSet getTableData(String schema, String table) { try { checkMetaDataObject(); metaData.setDatabaseConnection(getDatabaseConnection()); return metaData.getTableData(schema, table); } catch (DataSourceException e) { handleException(e); return null; } } /** * Drops the specified database object. * * @param dc - the database connection * @param object - the object to be dropped */ public int dropObject(DatabaseConnection dc, DatabaseObject object) throws SQLException { String queryStart = null; int type = object.getType(); switch (type) { case BrowserConstants.CATALOG_NODE: case BrowserConstants.SCHEMA_NODE: case BrowserConstants.OTHER_NODE: GUIUtilities.displayErrorMessage( "Dropping objects of this type is not currently supported"); return UPDATE_CANCELLED; case BrowserConstants.FUNCTIONS_NODE: queryStart = "DROP FUNCTION "; break; case BrowserConstants.INDEX_NODE: queryStart = "DROP INDEX "; break; case BrowserConstants.PROCEDURE_NODE: queryStart = "DROP PROCEDURE "; break; case BrowserConstants.SEQUENCE_NODE: queryStart = "DROP SEQUENCE "; break; case BrowserConstants.SYNONYM_NODE: queryStart = "DROP SYNONYM "; break; case BrowserConstants.SYSTEM_TABLE_NODE: case BrowserConstants.TABLE_NODE: queryStart = "DROP TABLE "; break; case BrowserConstants.TRIGGER_NODE: queryStart = "DROP TRIGGER "; break; case BrowserConstants.VIEW_NODE: queryStart = "DROP VIEW "; break; } if (querySender == null) { querySender = new QuerySender(dc); } else { querySender.setDatabaseConnection(dc); } String name = object.getName(); return querySender.updateRecords(queryStart + name).getUpdateCount(); } /** * Propagates the call to the meta data object. */ protected void closeConnection() { if (metaData != null) { metaData.closeConnection(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -