Search in sources :

Example 1 with INode

use of net.sourceforge.sqlexplorer.dbstructure.nodes.INode in project tdq-studio-se by Talend.

the class DBTreeActionGroup method fillContextMenu.

/**
 * Fill the node context menu with all the correct actions.
 *
 * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
 */
public void fillContextMenu(IMenuManager menu) {
    // find our target node..
    IStructuredSelection selection = (IStructuredSelection) _treeViewer.getSelection();
    // check if we have a valid selection
    if (selection == null) {
        return;
    }
    ArrayList selectedNodes = new ArrayList();
    Iterator it = selection.iterator();
    while (it.hasNext()) {
        Object object = it.next();
        if (object instanceof INode) {
            selectedNodes.add(object);
        }
    }
    if (selectedNodes.size() == 0) {
        return;
    }
    INode[] nodes = (INode[]) selectedNodes.toArray(new INode[] {});
    IAction[] actions = getContextActions(nodes);
    for (int i = 0; i < actions.length; i++) {
        menu.add(actions[i]);
    }
}
Also used : INode(net.sourceforge.sqlexplorer.dbstructure.nodes.INode) IAction(org.eclipse.jface.action.IAction) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint)

Example 2 with INode

use of net.sourceforge.sqlexplorer.dbstructure.nodes.INode in project tdq-studio-se by Talend.

the class TableInfoTab method getDataSet.

public DataSet getDataSet() throws Exception {
    INode node = getNode();
    if (node == null) {
        return null;
    }
    if (node instanceof TableNode) {
        TableNode tableNode = (TableNode) node;
        ITableInfo tableInfo = tableNode.getTableInfo();
        String[] header = new String[2];
        header[0] = Messages.getString("DatabaseDetailView.Tab.Info.Property");
        header[1] = Messages.getString("DatabaseDetailView.Tab.Info.Value");
        String[][] data = new String[6][2];
        data[0][0] = Messages.getString("DatabaseDetailView.Tab.Info.Name");
        data[0][1] = tableInfo.getSimpleName();
        data[1][0] = Messages.getString("DatabaseDetailView.Tab.Info.QualifiedName");
        data[1][1] = tableInfo.getQualifiedName();
        data[2][0] = Messages.getString("DatabaseDetailView.Tab.Info.Catalog");
        data[2][1] = tableInfo.getCatalogName();
        data[3][0] = Messages.getString("DatabaseDetailView.Tab.Info.Schema");
        data[3][1] = tableInfo.getSchemaName();
        data[4][0] = Messages.getString("DatabaseDetailView.Tab.Info.Type");
        data[4][1] = tableInfo.getType();
        data[5][0] = Messages.getString("DatabaseDetailView.Tab.Info.Remarks");
        data[5][1] = tableInfo.getRemarks();
        DataSet dataSet = new DataSet(header, data);
        return dataSet;
    }
    return null;
}
Also used : INode(net.sourceforge.sqlexplorer.dbstructure.nodes.INode) ITableInfo(net.sourceforge.squirrel_sql.fw.sql.ITableInfo) DataSet(net.sourceforge.sqlexplorer.dataset.DataSet) TableNode(net.sourceforge.sqlexplorer.dbstructure.nodes.TableNode)

Example 3 with INode

use of net.sourceforge.sqlexplorer.dbstructure.nodes.INode in project tdq-studio-se by Talend.

the class ConnectionInfoTab method getDataSet.

public DataSet getDataSet() throws Exception {
    INode node = getNode();
    if (node == null) {
        return null;
    }
    SQLDatabaseMetaData sqlMetaData = node.getSession().getMetaData();
    DatabaseMetaData jdbcMetaData = sqlMetaData.getJDBCMetaData();
    String[] header = new String[2];
    header[0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.Property");
    header[1] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.Value");
    String[][] data = new String[124][2];
    SQLConnection connection = node.getSession().grabConnection();
    boolean commitOnClose = false;
    try {
        commitOnClose = connection.getCommitOnClose();
    } finally {
        node.getSession().releaseConnection(connection);
    }
    data[0][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.DatabaseProductName");
    try {
        data[0][1] = sqlMetaData.getDatabaseProductName();
    } catch (Throwable e) {
    }
    data[1][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.DriverMajor");
    try {
        data[1][1] = "" + jdbcMetaData.getDriverMajorVersion();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[2][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.DriverMinor");
    try {
        data[2][1] = "" + jdbcMetaData.getDriverMinorVersion();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[3][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.DriverName");
    try {
        data[3][1] = "" + sqlMetaData.getDriverName();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[4][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.DriverVersion");
    try {
        data[4][1] = "" + jdbcMetaData.getDriverVersion();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[5][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.UserName");
    try {
        data[5][1] = "" + sqlMetaData.getUserName();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[6][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.URL");
    try {
        data[6][1] = "" + jdbcMetaData.getURL();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[7][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.AutocommitMode");
    try {
        data[7][1] = "" + jdbcMetaData.getConnection().getAutoCommit();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[8][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.CommitOnClose");
    // $NON-NLS-1$
    data[8][1] = "" + commitOnClose;
    data[9][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.ProceduresCallable");
    try {
        data[9][1] = "" + jdbcMetaData.allProceduresAreCallable();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[10][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.TablesSelectable");
    try {
        data[10][1] = "" + jdbcMetaData.allTablesAreSelectable();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[11][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.NullsSortedHigh");
    try {
        data[11][1] = "" + jdbcMetaData.nullsAreSortedHigh();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[12][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.NullsSortedLow");
    try {
        data[12][1] = "" + jdbcMetaData.nullsAreSortedLow();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[13][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.NullsSortedStart");
    try {
        data[13][1] = "" + jdbcMetaData.nullsAreSortedAtStart();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[14][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.NullsSortedEnd");
    try {
        data[14][1] = "" + jdbcMetaData.nullsAreSortedAtEnd();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[15][0] = Messages.getString("ConnectionInfoTab.data[15]");
    try {
        data[15][1] = "" + jdbcMetaData.getResultSetHoldability();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[16][0] = Messages.getString("ConnectionInfoTab.data[16]");
    try {
        data[16][1] = "" + jdbcMetaData.usesLocalFiles();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[17][0] = Messages.getString("ConnectionInfoTab.data[17]");
    try {
        data[17][1] = "" + jdbcMetaData.usesLocalFilePerTable();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[18][0] = Messages.getString("ConnectionInfoTab.data[18]");
    try {
        data[18][1] = "" + jdbcMetaData.supportsMixedCaseIdentifiers();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[19][0] = Messages.getString("ConnectionInfoTab.data[19]");
    try {
        data[19][1] = "" + jdbcMetaData.storesUpperCaseIdentifiers();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[20][0] = Messages.getString("ConnectionInfoTab.data[20]");
    // $NON-NLS-1$
    try {
        data[20][1] = "" + jdbcMetaData.storesLowerCaseIdentifiers();
    } catch (Throwable e) {
    }
    data[21][0] = Messages.getString("ConnectionInfoTab.data[21]");
    // $NON-NLS-1$
    try {
        data[21][1] = "" + jdbcMetaData.storesMixedCaseIdentifiers();
    } catch (Throwable e) {
    }
    data[22][0] = Messages.getString("ConnectionInfoTab.data[22]");
    // $NON-NLS-1$
    try {
        data[22][1] = "" + jdbcMetaData.supportsMixedCaseQuotedIdentifiers();
    } catch (Throwable e) {
    }
    data[23][0] = Messages.getString("ConnectionInfoTab.data[23]");
    // $NON-NLS-1$
    try {
        data[23][1] = "" + jdbcMetaData.storesUpperCaseQuotedIdentifiers();
    } catch (Throwable e) {
    }
    data[24][0] = Messages.getString("ConnectionInfoTab.data[24]");
    // $NON-NLS-1$
    try {
        data[24][1] = "" + jdbcMetaData.storesLowerCaseQuotedIdentifiers();
    } catch (Throwable e) {
    }
    data[25][0] = Messages.getString("ConnectionInfoTab.data[25]");
    // $NON-NLS-1$
    try {
        data[25][1] = "" + jdbcMetaData.storesMixedCaseQuotedIdentifiers();
    } catch (Throwable e) {
    }
    data[26][0] = Messages.getString("ConnectionInfoTab.data[26]");
    // $NON-NLS-1$
    try {
        data[26][1] = "" + jdbcMetaData.getIdentifierQuoteString();
    } catch (Throwable e) {
    }
    data[27][0] = Messages.getString("ConnectionInfoTab.data[27]");
    // $NON-NLS-1$
    try {
        data[27][1] = "" + jdbcMetaData.getSearchStringEscape();
    } catch (Throwable e) {
    }
    data[28][0] = Messages.getString("ConnectionInfoTab.data[28]");
    // $NON-NLS-1$
    try {
        data[28][1] = "" + jdbcMetaData.getExtraNameCharacters();
    } catch (Throwable e) {
    }
    data[29][0] = Messages.getString("ConnectionInfoTab.data[29]");
    try {
        // $NON-NLS-1$
        data[29][1] = "" + jdbcMetaData.supportsAlterTableWithAddColumn();
    } catch (Throwable e) {
    }
    data[30][0] = Messages.getString("ConnectionInfoTab.data[30]");
    try {
        // $NON-NLS-1$
        data[30][1] = "" + jdbcMetaData.supportsAlterTableWithDropColumn();
    } catch (Throwable e) {
    }
    data[31][0] = Messages.getString("ConnectionInfoTab.data[31]");
    try {
        // $NON-NLS-1$
        data[31][1] = "" + jdbcMetaData.supportsColumnAliasing();
    } catch (Throwable e) {
    }
    data[32][0] = Messages.getString("ConnectionInfoTab.data[32]");
    try {
        // $NON-NLS-1$
        data[32][1] = "" + jdbcMetaData.nullPlusNonNullIsNull();
    } catch (Throwable e) {
    }
    data[33][0] = Messages.getString("ConnectionInfoTab.data[33]");
    try {
        // $NON-NLS-1$
        data[33][1] = "" + jdbcMetaData.supportsConvert();
    } catch (Throwable e) {
    }
    data[34][0] = Messages.getString("ConnectionInfoTab.data[34]");
    try {
        // $NON-NLS-1$
        data[34][1] = "" + jdbcMetaData.supportsTableCorrelationNames();
    } catch (Throwable e) {
    }
    data[35][0] = Messages.getString("ConnectionInfoTab.data[35]");
    try {
        // $NON-NLS-1$
        data[35][1] = "" + jdbcMetaData.supportsDifferentTableCorrelationNames();
    } catch (Throwable e) {
    }
    data[36][0] = Messages.getString("ConnectionInfoTab.data[36]");
    try {
        data[36][1] = "" + jdbcMetaData.supportsExpressionsInOrderBy();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[37][0] = Messages.getString("ConnectionInfoTab.data[37]");
    try {
        data[37][1] = "" + jdbcMetaData.supportsOrderByUnrelated();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[38][0] = Messages.getString("ConnectionInfoTab.data[38]");
    try {
        data[38][1] = "" + jdbcMetaData.supportsGroupBy();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[39][0] = Messages.getString("ConnectionInfoTab.data[39]");
    try {
        data[39][1] = "" + jdbcMetaData.supportsGroupByUnrelated();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[40][0] = Messages.getString("ConnectionInfoTab.data[40]");
    try {
        data[40][1] = "" + jdbcMetaData.supportsGroupByBeyondSelect();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[41][0] = Messages.getString("ConnectionInfoTab.data[41]");
    try {
        data[41][1] = "" + jdbcMetaData.supportsLikeEscapeClause();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[42][0] = Messages.getString("ConnectionInfoTab.data[42]");
    try {
        data[42][1] = "" + jdbcMetaData.supportsMultipleResultSets();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[43][0] = Messages.getString("ConnectionInfoTab.data[43]");
    try {
        data[43][1] = "" + jdbcMetaData.supportsMultipleOpenResults();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[44][0] = Messages.getString("ConnectionInfoTab.data[44]");
    try {
        data[44][1] = "" + jdbcMetaData.supportsMultipleTransactions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[45][0] = Messages.getString("ConnectionInfoTab.data[45]");
    try {
        data[45][1] = "" + jdbcMetaData.supportsNonNullableColumns();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[46][0] = Messages.getString("ConnectionInfoTab.data[46]");
    try {
        data[46][1] = "" + jdbcMetaData.supportsMinimumSQLGrammar();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[47][0] = Messages.getString("ConnectionInfoTab.data[47]");
    try {
        data[47][1] = "" + jdbcMetaData.supportsCoreSQLGrammar();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[48][0] = Messages.getString("ConnectionInfoTab.data[48]");
    try {
        data[48][1] = "" + jdbcMetaData.supportsExtendedSQLGrammar();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[49][0] = Messages.getString("ConnectionInfoTab.data[49]");
    try {
        data[49][1] = "" + jdbcMetaData.supportsANSI92EntryLevelSQL();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[50][0] = Messages.getString("ConnectionInfoTab.data[50]");
    try {
        data[50][1] = "" + jdbcMetaData.supportsANSI92IntermediateSQL();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[51][0] = Messages.getString("ConnectionInfoTab.data[51]");
    try {
        data[51][1] = "" + jdbcMetaData.supportsANSI92FullSQL();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[52][0] = Messages.getString("ConnectionInfoTab.data[52]");
    try {
        data[52][1] = "" + jdbcMetaData.supportsIntegrityEnhancementFacility();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[53][0] = Messages.getString("ConnectionInfoTab.data[53]");
    try {
        data[53][1] = "" + jdbcMetaData.supportsOuterJoins();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[54][0] = Messages.getString("ConnectionInfoTab.data[54]");
    try {
        data[54][1] = "" + jdbcMetaData.supportsFullOuterJoins();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[55][0] = Messages.getString("ConnectionInfoTab.data[55]");
    try {
        data[55][1] = "" + jdbcMetaData.supportsLimitedOuterJoins();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[56][0] = Messages.getString("ConnectionInfoTab.data[56]");
    try {
        data[56][1] = "" + jdbcMetaData.getSchemaTerm();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[57][0] = Messages.getString("ConnectionInfoTab.data[57]");
    try {
        data[57][1] = "" + jdbcMetaData.getProcedureTerm();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[58][0] = Messages.getString("ConnectionInfoTab.data[58]");
    try {
        data[58][1] = "" + jdbcMetaData.getCatalogTerm();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[59][0] = Messages.getString("ConnectionInfoTab.data[59]");
    try {
        data[59][1] = "" + jdbcMetaData.isCatalogAtStart();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[60][0] = Messages.getString("ConnectionInfoTab.data[60]");
    try {
        data[60][1] = "" + jdbcMetaData.getCatalogSeparator();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[61][0] = Messages.getString("ConnectionInfoTab.data[61]");
    try {
        data[61][1] = "" + jdbcMetaData.supportsSchemasInDataManipulation();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[62][0] = Messages.getString("ConnectionInfoTab.data[62]");
    try {
        data[62][1] = "" + jdbcMetaData.supportsSchemasInProcedureCalls();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[63][0] = Messages.getString("ConnectionInfoTab.data[63]");
    try {
        data[63][1] = "" + jdbcMetaData.supportsSchemasInTableDefinitions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[64][0] = Messages.getString("ConnectionInfoTab.data[64]");
    try {
        data[64][1] = "" + jdbcMetaData.supportsSchemasInIndexDefinitions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[65][0] = Messages.getString("ConnectionInfoTab.data[65]");
    try {
        data[65][1] = "" + jdbcMetaData.supportsSchemasInPrivilegeDefinitions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[66][0] = Messages.getString("ConnectionInfoTab.data[66]");
    try {
        data[66][1] = "" + jdbcMetaData.supportsCatalogsInDataManipulation();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[67][0] = Messages.getString("ConnectionInfoTab.data[67]");
    try {
        data[67][1] = "" + jdbcMetaData.supportsCatalogsInProcedureCalls();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[68][0] = Messages.getString("ConnectionInfoTab.data[68]");
    try {
        data[68][1] = "" + jdbcMetaData.supportsCatalogsInTableDefinitions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[69][0] = Messages.getString("ConnectionInfoTab.data[69]");
    try {
        data[69][1] = "" + jdbcMetaData.supportsCatalogsInIndexDefinitions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[70][0] = Messages.getString("ConnectionInfoTab.data[70]");
    try {
        data[70][1] = "" + jdbcMetaData.supportsCatalogsInPrivilegeDefinitions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[71][0] = Messages.getString("ConnectionInfoTab.data[71]");
    try {
        data[71][1] = "" + jdbcMetaData.supportsPositionedDelete();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[72][0] = Messages.getString("ConnectionInfoTab.data[72]");
    try {
        data[72][1] = "" + jdbcMetaData.supportsPositionedUpdate();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[73][0] = Messages.getString("ConnectionInfoTab.data[73]");
    try {
        data[73][1] = "" + jdbcMetaData.supportsStoredProcedures();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[74][0] = Messages.getString("ConnectionInfoTab.data[74]");
    try {
        data[74][1] = "" + jdbcMetaData.supportsSubqueriesInComparisons();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[75][0] = Messages.getString("ConnectionInfoTab.data[75]");
    try {
        data[75][1] = "" + jdbcMetaData.supportsSubqueriesInExists();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[76][0] = Messages.getString("ConnectionInfoTab.data[76]");
    try {
        data[76][1] = "" + jdbcMetaData.supportsSubqueriesInIns();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[77][0] = Messages.getString("ConnectionInfoTab.data[77]");
    try {
        data[77][1] = "" + jdbcMetaData.supportsSubqueriesInQuantifieds();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[78][0] = Messages.getString("ConnectionInfoTab.data[78]");
    try {
        data[78][1] = "" + jdbcMetaData.supportsCorrelatedSubqueries();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[79][0] = Messages.getString("ConnectionInfoTab.data[79]");
    try {
        data[79][1] = "" + jdbcMetaData.supportsUnion();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[80][0] = Messages.getString("ConnectionInfoTab.data[80]");
    try {
        data[80][1] = "" + jdbcMetaData.supportsUnionAll();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[81][0] = Messages.getString("ConnectionInfoTab.data[81]");
    try {
        data[81][1] = "" + jdbcMetaData.supportsOpenCursorsAcrossCommit();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[82][0] = Messages.getString("ConnectionInfoTab.data[82]");
    try {
        data[82][1] = "" + jdbcMetaData.supportsOpenCursorsAcrossRollback();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[83][0] = Messages.getString("ConnectionInfoTab.data[83]");
    try {
        data[83][1] = "" + jdbcMetaData.supportsOpenStatementsAcrossCommit();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[84][0] = Messages.getString("ConnectionInfoTab.data[84]");
    try {
        data[84][1] = "" + jdbcMetaData.supportsOpenStatementsAcrossRollback();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[85][0] = Messages.getString("ConnectionInfoTab.data[85]");
    try {
        data[85][1] = "" + jdbcMetaData.getMaxBinaryLiteralLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[86][0] = Messages.getString("ConnectionInfoTab.data[86]");
    try {
        data[86][1] = "" + jdbcMetaData.getMaxCharLiteralLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[87][0] = Messages.getString("ConnectionInfoTab.data[87]");
    try {
        data[87][1] = "" + jdbcMetaData.getMaxColumnNameLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[88][0] = Messages.getString("ConnectionInfoTab.data[88]");
    try {
        data[88][1] = "" + jdbcMetaData.getMaxColumnsInGroupBy();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[89][0] = Messages.getString("ConnectionInfoTab.data[89]");
    try {
        data[89][1] = "" + jdbcMetaData.getMaxColumnsInIndex();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[90][0] = Messages.getString("ConnectionInfoTab.data[90]");
    try {
        data[90][1] = "" + jdbcMetaData.getMaxColumnsInOrderBy();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[91][0] = Messages.getString("ConnectionInfoTab.data[91]");
    try {
        data[91][1] = "" + jdbcMetaData.getMaxColumnsInSelect();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[92][0] = Messages.getString("ConnectionInfoTab.data[92]");
    try {
        data[92][1] = "" + jdbcMetaData.getMaxColumnsInTable();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[93][0] = Messages.getString("ConnectionInfoTab.data[93]");
    try {
        data[93][1] = "" + jdbcMetaData.getMaxConnections();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[94][0] = Messages.getString("ConnectionInfoTab.data[94]");
    try {
        data[94][1] = "" + jdbcMetaData.getMaxCursorNameLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[95][0] = Messages.getString("ConnectionInfoTab.data[95]");
    try {
        data[95][1] = "" + jdbcMetaData.getMaxIndexLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[96][0] = Messages.getString("ConnectionInfoTab.data[96]");
    try {
        data[96][1] = "" + jdbcMetaData.getMaxSchemaNameLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[97][0] = Messages.getString("ConnectionInfoTab.data[97]");
    try {
        data[97][1] = "" + jdbcMetaData.getMaxProcedureNameLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[98][0] = Messages.getString("ConnectionInfoTab.data[98]");
    try {
        data[98][1] = "" + jdbcMetaData.getMaxCatalogNameLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[99][0] = Messages.getString("ConnectionInfoTab.data[99]");
    try {
        data[99][1] = "" + jdbcMetaData.getMaxRowSize();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[100][0] = Messages.getString("ConnectionInfoTab.data[100]");
    try {
        data[100][1] = "" + jdbcMetaData.doesMaxRowSizeIncludeBlobs();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[101][0] = Messages.getString("ConnectionInfoTab.data[101]");
    try {
        data[101][1] = "" + jdbcMetaData.getMaxStatementLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[102][0] = Messages.getString("ConnectionInfoTab.data[102]");
    try {
        data[102][1] = "" + jdbcMetaData.getMaxStatements();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[103][0] = Messages.getString("ConnectionInfoTab.data[103]");
    try {
        data[103][1] = "" + jdbcMetaData.getMaxTableNameLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[104][0] = Messages.getString("ConnectionInfoTab.data[104]");
    try {
        data[104][1] = "" + jdbcMetaData.getMaxTablesInSelect();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[105][0] = Messages.getString("ConnectionInfoTab.data[105]");
    try {
        data[105][1] = "" + jdbcMetaData.getMaxUserNameLength();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[106][0] = Messages.getString("ConnectionInfoTab.data[106]");
    try {
        int isol = jdbcMetaData.getDefaultTransactionIsolation();
        String is = null;
        switch(isol) {
            case java.sql.Connection.TRANSACTION_NONE:
                // $NON-NLS-1$
                is = "TRANSACTION_NONE";
                break;
            case java.sql.Connection.TRANSACTION_READ_COMMITTED:
                // $NON-NLS-1$
                is = "TRANSACTION_READ_COMMITTED";
                break;
            case java.sql.Connection.TRANSACTION_READ_UNCOMMITTED:
                // $NON-NLS-1$
                is = "TRANSACTION_READ_UNCOMMITTED";
                break;
            case java.sql.Connection.TRANSACTION_REPEATABLE_READ:
                // $NON-NLS-1$
                is = "TRANSACTION_REPEATABLE_READ";
                break;
            case java.sql.Connection.TRANSACTION_SERIALIZABLE:
                // $NON-NLS-1$
                is = "TRANSACTION_SERIALIZABLE";
                break;
            default:
                // $NON-NLS-1$
                is = "";
                break;
        }
        data[106][1] = is;
    } catch (Throwable e) {
    }
    data[107][0] = Messages.getString("ConnectionInfoTab.data[107]");
    try {
        data[107][1] = "" + jdbcMetaData.supportsTransactions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[108][0] = Messages.getString("ConnectionInfoTab.data[108]");
    try {
        data[108][1] = "" + jdbcMetaData.supportsDataDefinitionAndDataManipulationTransactions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[109][0] = Messages.getString("ConnectionInfoTab.data[109]");
    try {
        data[109][1] = "" + jdbcMetaData.supportsDataManipulationTransactionsOnly();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[110][0] = Messages.getString("ConnectionInfoTab.data[110]");
    try {
        data[110][1] = "" + jdbcMetaData.dataDefinitionCausesTransactionCommit();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[111][0] = Messages.getString("ConnectionInfoTab.data[111]");
    try {
        data[111][1] = "" + jdbcMetaData.dataDefinitionIgnoredInTransactions();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[112][0] = Messages.getString("ConnectionInfoTab.data[112]");
    try {
        data[112][1] = "" + jdbcMetaData.supportsBatchUpdates();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[113][0] = Messages.getString("ConnectionInfoTab.data[113]");
    try {
        data[113][1] = "" + jdbcMetaData.supportsSavepoints();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[114][0] = Messages.getString("ConnectionInfoTab.data[114]");
    try {
        data[114][1] = "" + jdbcMetaData.supportsNamedParameters();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[115][0] = Messages.getString("ConnectionInfoTab.data[115]");
    try {
        data[115][1] = "" + jdbcMetaData.supportsGetGeneratedKeys();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[116][0] = Messages.getString("ConnectionInfoTab.data[116]");
    try {
        data[116][1] = "" + jdbcMetaData.getDatabaseMajorVersion();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[117][0] = Messages.getString("ConnectionInfoTab.data[117]");
    try {
        data[117][1] = "" + jdbcMetaData.getDatabaseMinorVersion();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[118][0] = Messages.getString("ConnectionInfoTab.data[118]");
    try {
        data[118][1] = "" + jdbcMetaData.getJDBCMinorVersion();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[119][0] = Messages.getString("ConnectionInfoTab.data[119]");
    try {
        data[119][1] = "" + jdbcMetaData.getJDBCMajorVersion();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[120][0] = Messages.getString("ConnectionInfoTab.data[120]");
    try {
        data[120][1] = "" + jdbcMetaData.getSQLStateType();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[121][0] = Messages.getString("ConnectionInfoTab.data[121]");
    try {
        data[121][1] = "" + jdbcMetaData.locatorsUpdateCopy();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[122][0] = Messages.getString("ConnectionInfoTab.data[122]");
    try {
        data[122][1] = "" + jdbcMetaData.supportsStatementPooling();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    data[123][0] = Messages.getString("DatabaseDetailView.Tab.ConnectionInfo.ReadOnly");
    try {
        data[123][1] = "" + jdbcMetaData.isReadOnly();
    }// $NON-NLS-1$
     catch (Throwable e) {
    }
    DataSet dataSet = new DataSet(header, data);
    return dataSet;
}
Also used : INode(net.sourceforge.sqlexplorer.dbstructure.nodes.INode) SQLDatabaseMetaData(net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData) DataSet(net.sourceforge.sqlexplorer.dataset.DataSet) SQLConnection(net.sourceforge.sqlexplorer.dbproduct.SQLConnection) SQLDatabaseMetaData(net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData) DatabaseMetaData(java.sql.DatabaseMetaData)

Example 4 with INode

use of net.sourceforge.sqlexplorer.dbstructure.nodes.INode in project tdq-studio-se by Talend.

the class PriviligesTab method getDataSet.

public DataSet getDataSet() throws Exception {
    INode node = getNode();
    if (node == null) {
        return null;
    }
    if (node instanceof TableNode) {
        TableNode tableNode = (TableNode) node;
        ResultSet resultSet = node.getSession().getMetaData().getTablePrivileges(tableNode.getTableInfo());
        DataSet dataSet = new DataSet(resultSet, new int[] { 3, 4, 5, 6, 7 });
        resultSet.close();
        return dataSet;
    }
    return null;
}
Also used : INode(net.sourceforge.sqlexplorer.dbstructure.nodes.INode) DataSet(net.sourceforge.sqlexplorer.dataset.DataSet) TableNode(net.sourceforge.sqlexplorer.dbstructure.nodes.TableNode) ResultSet(java.sql.ResultSet)

Example 5 with INode

use of net.sourceforge.sqlexplorer.dbstructure.nodes.INode in project tdq-studio-se by Talend.

the class RowIdsTab method getDataSet.

public DataSet getDataSet() throws Exception {
    INode node = getNode();
    if (node == null) {
        return null;
    }
    if (node instanceof TableNode) {
        TableNode tableNode = (TableNode) node;
        BestRowIdentifier[] rowIds = node.getSession().getMetaData().getBestRowIdentifier(tableNode.getTableInfo());
        Comparable[][] data = new Comparable[rowIds.length][];
        int index = 0;
        for (BestRowIdentifier rowId : rowIds) {
            Comparable[] row = new Comparable[COLUMN_LABELS.length];
            data[index++] = row;
            int i = 0;
            row[i++] = rowId.getScope();
            row[i++] = rowId.getColumnName();
            row[i++] = rowId.getSQLDataType();
            row[i++] = rowId.getTypeName();
            row[i++] = rowId.getPrecision();
            row[i++] = rowId.getScale();
            row[i++] = rowId.getPseudoColumn();
            if (i != COLUMN_LABELS.length)
                throw new RuntimeException(Messages.getString("RowIdsTab.RuntimeException"));
        }
        DataSet dataSet = new DataSet(COLUMN_LABELS, data);
        return dataSet;
    }
    return null;
}
Also used : INode(net.sourceforge.sqlexplorer.dbstructure.nodes.INode) DataSet(net.sourceforge.sqlexplorer.dataset.DataSet) TableNode(net.sourceforge.sqlexplorer.dbstructure.nodes.TableNode) BestRowIdentifier(net.sourceforge.squirrel_sql.fw.sql.dbobj.BestRowIdentifier)

Aggregations

INode (net.sourceforge.sqlexplorer.dbstructure.nodes.INode)22 TableNode (net.sourceforge.sqlexplorer.dbstructure.nodes.TableNode)15 DataSet (net.sourceforge.sqlexplorer.dataset.DataSet)12 ResultSet (java.sql.ResultSet)7 ArrayList (java.util.ArrayList)6 SQLException (java.sql.SQLException)4 Iterator (java.util.Iterator)3 List (java.util.List)2 TreeSet (java.util.TreeSet)2 SQLConnection (net.sourceforge.sqlexplorer.dbproduct.SQLConnection)2 DatabaseNode (net.sourceforge.sqlexplorer.dbstructure.nodes.DatabaseNode)2 SchemaNode (net.sourceforge.sqlexplorer.dbstructure.nodes.SchemaNode)2 TableFolderNode (net.sourceforge.sqlexplorer.dbstructure.nodes.TableFolderNode)2 Point (org.eclipse.swt.graphics.Point)2 DatabaseMetaData (java.sql.DatabaseMetaData)1 Statement (java.sql.Statement)1 LinkedList (java.util.LinkedList)1 SQLCannotConnectException (net.sourceforge.sqlexplorer.SQLCannotConnectException)1 Alias (net.sourceforge.sqlexplorer.dbproduct.Alias)1 User (net.sourceforge.sqlexplorer.dbproduct.User)1