public String getSchemaName() { if (null != _objectTreeNode) { return _objectTreeNode.getDatabaseObjectInfo().getSchemaName(); } else { return _tableInfo.getSchemaName(); } }
public static String getTableName(ITableInfo ti, boolean qualifyTableNames, boolean useDoubleQuotes) { return DialectUtils.formatQualified(ti.getSimpleName(), ti.getSchemaName(), qualifyTableNames, useDoubleQuotes); }
/** * * @param columnList * @param ti * @return * @throws SQLException */ public static String getSelectQuery(SessionInfoProvider prov, String columnList, ITableInfo ti) throws SQLException, UserCancelledOperationException { StringBuilder result = new StringBuilder("select "); result.append(columnList); result.append(" from "); ISession sourceSession = prov.getSourceSession(); String tableName = getQualifiedObjectName( sourceSession, ti.getCatalogName(), ti.getSchemaName(), ti.getSimpleName(), DialectFactory.SOURCE_TYPE); result.append(tableName); return result.toString(); }
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; }
public void execute() { StringBuffer sqlBuffer = new StringBuffer(); final String sqlSep = _session.getQueryTokenizer().getSQLStatementSeparator(); sqlBuffer.append("DBCC SHOW_STATISTICS(["); sqlBuffer.append(_tableInfo.getCatalogName()); sqlBuffer.append("."); sqlBuffer.append(_tableInfo.getSchemaName()); 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); } }
} else if (md.supportsSchemasInTableDefinitions()) rs = md.getPrimaryKeys(null, ti.getSchemaName(), ti.getSimpleName()); } else
matches &= matchesMetaString(ti.getSchemaName(), schemaName); matches &= matchesMetaString(ti.getSimpleName(), simpleName);
/** * 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()); }
schemaTF.setPreferredSize(mediumField); schemaTF.setEditable(false); schemaTF.setText(tableInfos[0].getSchemaName()); pane.add(schemaTF, getFieldConstraints(c));
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); } }
/** * 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()); }
String nameWithSchemaAndCatalog = simpleName; if (null != tables[i].getSchemaName() && 0 < tables[i].getSchemaName().length()) nameWithSchema = tables[i].getSchemaName().toUpperCase() + "." + nameWithSchema; nameWithSchemaAndCatalog = nameWithSchema;
/** * 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 * @throws java.sql.SQLException */ private boolean isMaterializedView(final ITableInfo ti, final ISession session) throws SQLException { 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()); }
matches &= matchesMetaString(ti.getSchemaName(), schemaName); matches &= matchesMetaString(ti.getSimpleName(), simpleName);
if(null != schema && false == schema.equalsIgnoreCase(iTableInfo.getSchemaName()) )
if(null != schema && false == schema.equalsIgnoreCase(iTableInfo.getSchemaName()) )
DBUtil.getTableCount(sourceSession, ti.getCatalogName(), ti.getSchemaName(), ti.getSimpleName(), DialectFactory.SOURCE_TYPE);
{ ti.getSimpleName(), ti.getSchemaName() }); throw new MappingException(msg);
private void showCustomDialog() throws SQLException String schema = selectedTable.getSchemaName(); String catalog = selectedTable.getCatalogName(); ITableInfo[] tables = _session.getSchemaInfo().getITableInfos(catalog, schema);
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); }