Package net.sourceforge.squirrel_sql.client.session

Examples of net.sourceforge.squirrel_sql.client.session.ISession


  {
    if (prov == null)
    {
      return;
    }
    ISession sourceSession = prov.getCopySourceSession();
    ISession destSession = prov.getCopyDestSession();
    if (sourceSession == null || destSession == null)
    {
      return;
    }
    ISQLConnection sourceCon = sourceSession.getSQLConnection();
    ISQLConnection con = destSession.getSQLConnection();
    TableColumnInfo[] colInfoArr = null;
    try
    {
      colInfoArr = sourceCon.getSQLMetaData().getColumnInfo(ti);
    } catch (SQLException e)
    {
      // ignore any SQLExceptions. This would only if we could not get
      // column info from the SQL database meta data.
      return;
    }
    for (int colIdx = 0; colIdx < colInfoArr.length; colIdx++)
    {
      TableColumnInfo colInfo = colInfoArr[colIdx];
      IDatabaseObjectInfo selectedDestObj = prov.getDestSelectedDatabaseObject();
      String schema = selectedDestObj.getSimpleName();
      String catalog = selectedDestObj.getCatalogName();
      String tableName = getQualifiedObjectName(
         destSession, catalog, schema, TEST_TABLE_NAME, DialectFactory.DEST_TYPE);

      StringBuilder sql = new StringBuilder("CREATE TABLE ");
      sql.append(tableName);
      sql.append(" ( ");
      sql.append(colInfo.getColumnName());
      sql.append(" CHAR(10) )");
      boolean cascade = DialectFactory.isFrontBase(destSession.getMetaData());
      try
      {
        dropTable(TEST_TABLE_NAME, schema, catalog, destSession, cascade, DialectFactory.DEST_TYPE);
        DBUtil.executeUpdate(con, sql.toString(), false);
      } catch (SQLException e)
View Full Code Here


    private void testColType(ISQLDatabaseMetaData md,
                             String toDb,
                             TableColumnInfo column)
        throws Exception
    {
        ISession sourceSession = AppTestUtil.getEasyMockSession(md);
        ISession destSession = AppTestUtil.getEasyMockSession(toDb);
       
       
        String type = ColTypeMapper.mapColType(sourceSession,
                                               destSession,
                                               column,
View Full Code Here

                             String toDb,
                             TableColumnInfo column,
                             ResultSet rs)
        throws Exception
    {
        ISession sourceSession = AppTestUtil.getEasyMockSession(md, rs);
        ISession destSession = AppTestUtil.getEasyMockSession(toDb);


        String type = ColTypeMapper.mapColType(sourceSession,
                                               destSession,
                                               column,
View Full Code Here

    /**
     * Open the script.
     * @param prov
     */
    private void initializeScript(SessionInfoProvider prov) {
        ISession source = prov.getCopySourceSession();
        ISession dest = prov.getCopyDestSession();
        ScriptWriter.open(source,dest);
    }
View Full Code Here

    /* (non-Javadoc)
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    public void actionPerformed(ActionEvent evt) {
        ISession destSession = sessionInfoProv.getCopyDestSession();
        IObjectTreeAPI api =
            destSession.getObjectTreeAPIOfActiveSessionWindow();
        if (api == null) {
            return;
        }
        IDatabaseObjectInfo[] dbObjs = api.getSelectedDatabaseObjects();
        if (dbObjs.length > 1) {
            sessionInfoProv.setDestSelectedDatabaseObject(null);
            //i18n[PasteTableAction.error.multischemapaste=The paste
            //operation may only be applied to one schema at a time]
            String msg =
              s_stringMgr.getString("PasteTableAction.error.multischemapaste");
            app.showErrorDialog(msg);
                           
            return;
        } else {
          // When the user pastes on a TABLE label which is located under a
          // schema/catalog, build the schema DatabaseObjectInfo.
          if (DatabaseObjectType.TABLE_TYPE_DBO.equals(dbObjs[0].getDatabaseObjectType())) {
            IDatabaseObjectInfo tableLabelInfo = dbObjs[0];
            ISQLConnection destCon = destSession.getSQLConnection();
            SQLDatabaseMetaData md = null;
            if (destCon != null) {
              md = destCon.getSQLMetaData();
            }
            IDatabaseObjectInfo schema =
View Full Code Here

        ISQLDatabaseMetaData md = createNiceMock(ISQLDatabaseMetaData.class);
        expect(md.getCatalogSeparator()).andReturn(".");
        expect(md.supportsCatalogsInTableDefinitions()).andReturn(true);
        expect(md.supportsSchemasInTableDefinitions()).andReturn(true);
        replay(md);
        ISession session = createNiceMock(ISession.class);
        expect(session.getMetaData()).andReturn(md).anyTimes();
        replay(session);
        String catalog = "TestCatalog";
        String schema = "TestSchema";
        String table = "TestTable";
        // case shouldn't be changed in this test because the context is the
View Full Code Here

  @Before
  public void setUp() throws Exception
  {
    super.setUp();
   
    ISession session = EasyMock.createMock(ISession.class);
    ISQLDatabaseMetaData metaData = EasyMock.createMock(ISQLDatabaseMetaData.class);
    expect(session.getMetaData()).andStubReturn(metaData);
    expect(metaData.getDatabaseProductName()).andStubReturn("Oracle");
    expect(metaData.getDatabaseProductVersion()).andStubReturn("10g");
   
    classUnderTest = new SupportedRefactoringsTab(session);
    clazz = SupportedRefactoringsTab.class;
View Full Code Here

    }
   
    private int[] getTableCounts() {
        int[] result = null;
       
        ISession sourceSession = prov.getDiffSourceSession();
        IDatabaseObjectInfo[] dbObjs = prov.getSourceSelectedDatabaseObjects();
        if (dbObjs != null) {
            result = new int[dbObjs.length];
            for (int i = 0; i < dbObjs.length; i++) {
                if (false == dbObjs[i] instanceof ITableInfo) {
View Full Code Here

  /**
   * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
   */
  public void actionPerformed(ActionEvent evt)
  {
    ISession destSession = sessionInfoProv.getDiffDestSession();
    IObjectTreeAPI api = destSession.getObjectTreeAPIOfActiveSessionWindow();
    if (api == null) { return; }
    IDatabaseObjectInfo[] dbObjs = api.getSelectedDatabaseObjects();
    sessionInfoProv.setDestSelectedDatabaseObjects(dbObjs);

    if (sessionInfoProv.getDiffSourceSession() == null) { return; }
View Full Code Here

   *
   * @return true if they are different sessions; false otherwise.
   */
  private boolean sourceDestSchemasDiffer()
  {
    ISession sourceSession = sessionInfoProv.getDiffSourceSession();
    ISession destSession = sessionInfoProv.getDiffDestSession();
    return sourceSession != null && ! sourceSession.equals(destSession);
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.client.session.ISession

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.