private void onTablesDropped(List<ITableInfo> tis, Point dropPoint) { Positioner positioner = new Positioner(dropPoint); for (ITableInfo ti : tis) { addTableIntern(positioner, ti.getSimpleName(), ti.getSchemaName(), ti.getCatalogName(), null); } }
/** * Get the full name of this table, creating that name the first time we are called */ public String getFullTableName() { if (fullTableName == null) { try { final String name = ti.getQualifiedName(); fullTableName = getUnambiguousTableName(_session, name); } catch (Exception e) { s_log.error( "getFullTableName: Unexpected exception - "+e.getMessage(), e); } } return fullTableName; }
boolean matches = matchesMetaString(ti.getCatalogName(), catalogName); matches &= matchesMetaString(ti.getSchemaName(), schemaName); matches &= matchesMetaString(ti.getSimpleName(), simpleName); for (int j = 0; j < types.length; j++) if(types[j].equals(ti.getType())) CaseInsensitiveString ciSimpleTableName = new CaseInsensitiveString(ti.getSimpleName()); List<ITableInfo> tableInfos = _tableInfosBySimpleName.get(ciSimpleTableName); tableInfos.remove(ti);
public static String getTableName(ITableInfo ti, boolean qualifyTableNames, boolean useDoubleQuotes) { return DialectUtils.formatQualified(ti.getSimpleName(), ti.getSchemaName(), qualifyTableNames, useDoubleQuotes); }
private String[] getSimpleNames(ITableInfo[] tableInfos) { String[] result = new String[tableInfos.length]; for (int i = 0; i < result.length; i++) { result[i] = tableInfos[i].getSimpleName(); } return result; }
private void showCustomDialog() throws SQLException { ITableInfo selectedTable = (ITableInfo) _info[0]; ITableInfo[] tables = _session.getSchemaInfo().getITableInfos(selectedTable.getCatalogName(), selectedTable.getSchemaName()); TableColumnInfo[] tableColumnInfos = _session.getMetaData().getColumnInfo(selectedTable); _allTables = new HashMap<String, TableColumnInfo[]>(); for (ITableInfo table : tables) { TableColumnInfo[] columns = safeGetColumns(table); if (table.getDatabaseObjectType() == DatabaseObjectType.TABLE && table != selectedTable && columns != null) { _allTables.put(table.getSimpleName(), columns); } } customDialog = dialogFactory.createDialog(selectedTable.getSimpleName(), tableColumnInfos, _allTables); customDialog.addExecuteListener(new ExecuteListener()); customDialog.addEditSQLListener(new EditSQLListener(customDialog)); customDialog.addShowSQLListener(new ShowSQLListener(i18n.SHOWSQL_DIALOG_TITLE, customDialog)); customDialog.setLocationRelativeTo(SessionUtils.getOwningFrame(_session)); customDialog.setVisible(true); }
public void execute() { StringBuffer sqlBuffer = new StringBuffer(); final String sqlSep = _session.getQueryTokenizer().getSQLStatementSeparator(); sqlBuffer.append("DBCC INDEXDEFRAG("); sqlBuffer.append(_tableInfo.getCatalogName()); sqlBuffer.append(","); sqlBuffer.append(_tableInfo.getSimpleName()); sqlBuffer.append(","); sqlBuffer.append(_indexName); sqlBuffer.append(")\n"); sqlBuffer.append(sqlSep); sqlBuffer.append(" \n"); _session.getSessionInternalFrame().getSQLPanelAPI().appendSQLScript(sqlBuffer.toString(), true); _session.getSessionInternalFrame().getSQLPanelAPI().executeCurrentSQL(); _session.selectMainTab(ISession.IMainPanelTabIndexes.SQL_TAB); } }
/** * @throws SQLException */ public void showCustomDialog() throws SQLException { ITableInfo ti = (ITableInfo) _info[0]; TableColumnInfo[] columns = _session.getMetaData().getColumnInfo(ti); if (columns == null || columns.length == 0) { _session.showErrorMessage(s_stringMgr.getString("AddPrimaryKeyCommand.noColumns", ti.getSimpleName())); return; } // Show the user a dialog with a list of columns and ask them to select one or more columns to drop customDialog = new ColumnListDialog(columns, ColumnListDialog.ADD_PRIMARY_KEY_MODE); customDialog.setTableName(ti.getQualifiedName()); // Set a default primary key name based on the name of the table customDialog.setPrimaryKeyName("PK_" + columns[0].getTableName().toUpperCase()); customDialog.addColumnSelectionListener(new ExecuteListener()); customDialog.addEditSQLListener(new EditSQLListener(customDialog)); customDialog.addShowSQLListener(new ShowSQLListener(i18n.SHOWSQL_DIALOG_TITLE, customDialog)); customDialog.setLocationRelativeTo(SessionUtils.getOwningFrame(_session)); customDialog.setMultiSelection(); customDialog.setVisible(true); }
catalogTF.setPreferredSize(mediumField); catalogTF.setEditable(false); catalogTF.setText(tableInfos[0].getCatalogName()); pane.add(catalogTF, getFieldConstraints(c)); schemaTF.setPreferredSize(mediumField); schemaTF.setEditable(false); schemaTF.setText(tableInfos[0].getSchemaName()); pane.add(schemaTF, getFieldConstraints(c));
private boolean fulfillsPlatformDependendMatches(ITableInfo iTableInfo, String catalog) { if(SQLDatabaseMetaData.DriverMatch.isComHttxDriver(_session.getSQLConnection())) { return ( iTableInfo.getCatalogName()==null && "\".\"".equals(catalog)); } else { return false; } }
public String getSchemaName() { if (null != _objectTreeNode) { return _objectTreeNode.getDatabaseObjectInfo().getSchemaName(); } else { return _tableInfo.getSchemaName(); } }
public static int getObjectInfoType(IDatabaseObjectInfo oi) { if (oi instanceof ITableInfo) { String tableType = ((ITableInfo) oi).getType(); if (tableType.equals("TABLE")) return MSSQL_TABLE; else if (tableType.equals("VIEW")) return MSSQL_VIEW; else return MSSQL_UNKNOWN; } else if (oi instanceof IProcedureInfo) { /* i do believe the getSimpleName() will end in ;1 if it's a procedure * and ;0 if it's a UDF. */ String simpleName = oi.getSimpleName(); if (simpleName.endsWith(";0")) return MSSQL_UDF; else if (simpleName.endsWith(";1")) return MSSQL_STOREDPROCEDURE; else return MSSQL_UNKNOWN; } else if (oi instanceof IUDTInfo) { return MSSQL_UDT; } else return MSSQL_UNKNOWN; }
public int compare(ITableInfo o1, ITableInfo o2) { return o1.getSimpleName().compareTo(o2.getSimpleName()); } }
private void showCustomDialog() throws SQLException String schema = selectedTable.getSchemaName(); String catalog = selectedTable.getCatalogName(); ITableInfo[] tables = _session.getSchemaInfo().getITableInfos(catalog, schema); selectedTable.getSimpleName())); return; for (ITableInfo table : tables) if (table.getDatabaseObjectType() == DatabaseObjectType.TABLE) allTables.put(table.getSimpleName(), _session.getMetaData().getColumnInfo(table));
/** * Returns a boolean value indicating whether or not the specified table info is not only a table, but also * a materialized view. * * @param ti * @param session * @return */ private boolean isMaterializedView(ITableInfo ti, ISession session) { if (!DialectFactory.isOracle(session.getMetaData())) { // Only Oracle supports materialized views directly. return false; } if (matViewLookup == null) { initMatViewLookup(session, ti.getSchemaName()); } return matViewLookup.contains(ti.getSimpleName()); }
DBUtil.getTableInfo(prov.getDestSession(), destSchema, chooseDestTableInfo(sourceTableInfo, pasteToTableInfo).getSimpleName()); sourceTableInfo.getQualifiedName(), destTableInfo.getQualifiedName());
private boolean fulfillsPlatformDependendMatches(ITableInfo iTableInfo, String catalog) { if(SQLDatabaseMetaData.DriverMatch.isComHttxDriver(_session.getSQLConnection())) { return ( iTableInfo.getCatalogName()==null && "\".\"".equals(catalog)); } else { return false; } }
String schemBuf = infos[i].getSchemaName(); schemas.put(schemBuf, schemBuf);
private boolean isMQT() { final IDatabaseObjectInfo doi = getDatabaseObjectInfo(); boolean isMQT = false; if (doi.getDatabaseObjectType() == DatabaseObjectType.TABLE) { ITableInfo info = (ITableInfo) doi; if (info.getType().startsWith("MATERIALIZED")) { isMQT = true; if (s_log.isDebugEnabled()) { s_log.debug("Table " + doi.getSimpleName() + " appears to be an MQT"); } } else { if (s_log.isDebugEnabled()) { s_log.debug("Table " + doi.getSimpleName() + " appears to be a regular table"); } } } return isMQT; }
public static boolean tableHasPrimaryKey(ISQLConnection con, ITableInfo ti) throws SQLException { boolean result = false; ResultSet rs = null; try { DatabaseMetaData md = con.getConnection().getMetaData(); String cat = ti.getCatalogName(); String schema = ti.getSchemaName(); String tableName = ti.getSimpleName(); rs = md.getPrimaryKeys(cat, schema, tableName); if (rs.next()) { result = true; } } finally { SQLUtilities.closeResultSet(rs); } return result; }