Package net.sourceforge.squirrel_sql.fw.sql

Examples of net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData


      _cb = cb;
    }

    public void run()
    {
      final SQLDatabaseMetaData md = _session.getSQLConnection().getSQLMetaData();
      List<ITableInfo> orderedTables = _tables;
      try
      {
        orderedTables = SQLUtilities.getDeletionOrder(_tables, md, _cb);
      }
      catch (Exception e)
      {
        s_log.error("Unexpected exception while attempting to order tables", e);
      } finally {
        GUIUtils.processOnSwingEventThread(new Runnable()
        {
          public void run()       
          {
            _cb.setVisible(false);
          }
        });
      }
      final String sqlSep = _session.getQueryTokenizer().getSQLStatementSeparator();
      String cascadeClause = null;
      try
      {
        cascadeClause = md.getCascadeClause();
      }
      catch (SQLException e)
      {
        s_log.error("Unexpected exception while attempting to get cascade clause", e);
      }
View Full Code Here


    final List<File> files = new ArrayList<File>();
    final List<String> titles = new ArrayList<String>();
    synchronized (_session)
    {
      final ISQLConnection conn = _session.getSQLConnection();
      final SQLDatabaseMetaData md = conn.getSQLMetaData();

      // Dump session properties.
      try
      {
        files.add(createJavaBeanDumpFile(_session.getProperties()));
        titles.add("Session Properties");
      }
      catch (Throwable th)
      {
        final String msg = "Error dumping driver info";
        showErrorMessage(msg);
        showErrorMessage(th);
        s_log.error(msg, th);
      }
 
      // Dump driver information.
      try
      {
        files.add(createJavaBeanDumpFile(_session.getDriver()));
        titles.add("Driver");
      }
      catch (Throwable th)
      {
        final String msg = "Error dumping driver info";
                showErrorMessage(msg);
                showErrorMessage(th);
        s_log.error(msg, th);
      }
 
      // Dump alias information.
      try
      {
        files.add(createJavaBeanDumpFile(_session.getAlias()));
        titles.add("Alias");
      }
      catch (Throwable th)
      {
        final String msg = "Error dumping alias info";
        showErrorMessage(msg);
        showErrorMessage(th);
        s_log.error(msg, th);
      }
 
      // Dump general connection info.
      try
      {
        files.add(createGeneralConnectionDumpFile(conn));
        titles.add("Connection - General");
      }
      catch (Throwable th)
      {
        final String msg = "Error dumping general connection info";
        showErrorMessage(msg);
        showErrorMessage(th);
        s_log.error(msg, th);
      }
 
      // Dump meta data.
      try
      {
        File tempFile = File.createTempFile(PREFIX, SUFFIX);
        IDataSetViewer dest = new DataSetViewerTextFileDestination(tempFile);
        dest.show(conn.getSQLMetaData().getMetaDataSet());
        files.add(tempFile);
        titles.add("Metadata");
      }
      catch (Throwable th)
      {
        final String msg = "Error dumping metadata";
        showErrorMessage(msg);
        showErrorMessage(th);
        s_log.error(msg, th);
      }
 
      // Dump catalogs.
      try
      {
        File tempFile = File.createTempFile(PREFIX, SUFFIX);
        IDataSetViewer dest = new DataSetViewerTextFileDestination(tempFile);
        dest.show(new ObjectArrayDataSet(md.getCatalogs()));
        files.add(tempFile);
        titles.add("Catalogs");
      }
      catch (Throwable th)
      {
        final String msg = "Error dumping catalogs";
        showErrorMessage(msg);
        showErrorMessage(th);
        s_log.error(msg, th);
      }
 
      // Dump schemas.
      try
      {
        File tempFile = File.createTempFile(PREFIX, SUFFIX);
        IDataSetViewer dest = new DataSetViewerTextFileDestination(tempFile);
        dest.show(new ObjectArrayDataSet(_session.getSchemaInfo().getSchemas()));
        files.add(tempFile);
        titles.add("Schemas");
      }
      catch (Throwable th)
      {
        final String msg = "Error dumping schemas";
        showErrorMessage(msg);
        showErrorMessage(th);
        s_log.error(msg, th);
      }
 
      // Dump data types.
      try
      {
        File tempFile = File.createTempFile(PREFIX, SUFFIX);
        IDataSetViewer dest = new DataSetViewerTextFileDestination(tempFile);
        dest.show(conn.getSQLMetaData().getTypesDataSet());
        files.add(tempFile);
        titles.add("Data Types");
      }
      catch (Throwable th)
      {
        final String msg = "Error dumping data types";
        showErrorMessage(msg);
        showErrorMessage(th);
        s_log.error(msg, th);
      }
 
      // Dump table types.
      try
      {
        File tempFile = File.createTempFile(PREFIX, SUFFIX);
        IDataSetViewer dest = new DataSetViewerTextFileDestination(tempFile);
        dest.show(new ObjectArrayDataSet(md.getTableTypes()));
        files.add(tempFile);
        titles.add("Table Types");
      }
      catch (Throwable th)
      {
View Full Code Here

   * Create the <TT>IDataSet</TT> to be displayed in this tab.
   */
  protected IDataSet createDataSet() throws DataSetException
  {
    final ISQLConnection conn = getSession().getSQLConnection();
        final SQLDatabaseMetaData dmd = conn.getSQLMetaData();
       
        ITableInfo ti = getTableInfo();
        if (! "TABLE".equalsIgnoreCase(ti.getType())) {
          // Frontbase describes it's tables as "BASE TABLE".
          if (!DialectFactory.isFrontBase(dmd)) {
            return null
          }
        }
        ResultSetDataSet rsds =
            dmd.getIndexInfo(getTableInfo(), indexIndices, true);
        rsds.next(null);
        String indexName = (String)rsds.get(1);
        if (indexName == null) {
            rsds.removeRow(0);
        }
View Full Code Here

    ISession mockSession = mockHelper.createMock(ISession.class);
    IApplication mockApplication = mockHelper.createMock(IApplication.class);
    IIdentifier mockIdentifier = mockHelper.createMock(IIdentifier.class);
    SessionManager mockSessionManager = mockHelper.createMock(SessionManager.class);
    ISQLConnection mockSqlConnection = mockHelper.createMock(ISQLConnection.class);
    SQLDatabaseMetaData mockMetaData = mockHelper.createMock(SQLDatabaseMetaData.class);
    IProcedureInfo mockProcedureInfo = mockHelper.createMock(IProcedureInfo.class);
   
    expect(mockSessionManager.getSession(mockIdentifier)).andStubReturn(mockSession);
    expect(mockSession.getApplication()).andStubReturn(mockApplication);
    expect(mockSession.getIdentifier()).andStubReturn(mockIdentifier);
    expect(mockApplication.getSessionManager()).andStubReturn(mockSessionManager);
    expect(mockSession.getSQLConnection()).andStubReturn(mockSqlConnection);
    expect(mockSqlConnection.getSQLMetaData()).andStubReturn(mockMetaData);
    expect(mockMetaData.getProcedureColumnsDataSet(mockProcedureInfo)).andStubReturn(null);
   
    mockHelper.replayAll();
    classUnderTest.setProcedureInfo(mockProcedureInfo);
    classUnderTest.setSession(mockSession);
    classUnderTest.createDataSet();
View Full Code Here

  protected IDataSet createDataSet() throws DataSetException
  {
    try
    {
      final ISQLConnection conn = getSession().getSQLConnection();
      final SQLDatabaseMetaData md = conn.getSQLMetaData();
      final ITableInfo ti = getTableInfo();
      final BestRowIdentifier[] bris = md.getBestRowIdentifier(ti);
      return new JavabeanArrayDataSet(AdapterFactory.getInstance().createBestRowIdentifierAdapter(bris));
    }
    catch (SQLException ex)
    {
      throw new DataSetException(ex);
View Full Code Here

  /**
   * Create the <TT>IDataSet</TT> to be displayed in this tab.
   */
  protected IDataSet createDataSet() throws DataSetException
  {
    final SQLDatabaseMetaData md =
            getSession().getSQLConnection().getSQLMetaData();
        ITableInfo ti = getTableInfo();
        return md.getTablePrivilegesDataSet(ti, columnIndices, true);
  }
View Full Code Here

  protected IDataSet createDataSet() throws DataSetException
  {
    final ISession session = getSession();
    try
    {
      final SQLDatabaseMetaData md = session.getSQLConnection().getSQLMetaData();
      return new ObjectArrayDataSet(md.getCatalogs());
    }
    catch (SQLException ex)
    {
      throw new DataSetException(ex);
    }
View Full Code Here

  /**
   * Create the <TT>IDataSet</TT> to be displayed in this tab.
   */
  protected IDataSet createDataSet() throws DataSetException
  {
    final SQLDatabaseMetaData md =
            getSession().getSQLConnection().getSQLMetaData();
        final ITableInfo ti = getTableInfo();
        return md.getColumnPrivilegesDataSet(ti,columnIndices, true);
  }
View Full Code Here

  protected IDataSet createDataSet() throws DataSetException
  {
    final ISession session = getSession();
    try
    {
      final SQLDatabaseMetaData md = session.getSQLConnection().getSQLMetaData();
      return new ObjectArrayDataSet(md.getNumericFunctions());
    }
    catch (SQLException ex)
    {
      throw new DataSetException(ex);
    }
View Full Code Here

  protected IDataSet createDataSet() throws DataSetException
  {
    final ISession session = getSession();
    try
    {
      final SQLDatabaseMetaData md = session.getSQLConnection().getSQLMetaData();
      return new ObjectArrayDataSet(md.getStringFunctions());
    }
    catch (SQLException ex)
    {
      throw new DataSetException(ex);
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.