Package net.sourceforge.squirrel_sql.client.session.properties

Examples of net.sourceforge.squirrel_sql.client.session.properties.SessionProperties


   *
   * @param  propertyName  Name of property that has changed.
   */
  private void propertiesHaveChanged(PropertyChangeEvent evt)
  {
      SessionProperties props = _session.getProperties();
      if (evt == null
         || evt.getPropertyName().equals(
            SessionProperties.IPropertyNames.SQL_RESULTS_TAB_PLACEMENT))
      {
         _tp.setTabPlacement(props.getSQLResultsTabPlacement());
      }
   }
View Full Code Here


               JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg);
            }
         }
         else
         {
            SessionProperties props = _session.getProperties();

            String readOnlyOutput = props.getReadOnlySQLResultsOutputClassName();

            _resultSetOutput = BaseDataSetViewerDestination.getInstance(readOnlyOutput, _creator);
            _resultSetSp.setViewportView(_resultSetOutput.getComponent());
            _resultSetSp.setRowHeader(null);
            _rsds.resetCursor();
View Full Code Here

  public Component getComponent()
  {
    if (_comp == null)
    {
      ISession session = getSession();
      SessionProperties props = session.getProperties();
      String destClassName = props.getMetaDataOutputClassName();
      try
      {
        _comp = new DataSetScrollingPanel(destClassName, null);
      } catch (Exception e)
      {
View Full Code Here

      new SQLHistoryController(_session, getSQLPanelAPI(), ((SQLHistoryComboBoxModel)_sqlCombo.getModel()).getItems());
   }

  private void propertiesHaveChanged(String propName)
  {
    final SessionProperties props = _session.getProperties();
    if (propName == null || propName.equals(
        SessionProperties.IPropertyNames.SQL_SHARE_HISTORY))
    {
      _sqlCombo.setUseSharedModel(props.getSQLShareHistory());
    }

    if (propName == null || propName.equals(SessionProperties.IPropertyNames.AUTO_COMMIT))
    {
            SetAutoCommitTask task = new SetAutoCommitTask();
            if (SwingUtilities.isEventDispatchThread()) {
                _session.getApplication().getThreadPool().addTask(task);
            } else {
                task.run();
            }
    }

    if (propName == null || propName.equals(SessionProperties.IPropertyNames.SQL_LIMIT_ROWS))
    {
      _limitRowsChk.setSelected(props.getSQLLimitRows());
    }

    if (propName == null
      || propName.equals(SessionProperties.IPropertyNames.SQL_NBR_ROWS_TO_SHOW))
    {
      _nbrRows.setInt(props.getSQLNbrRowsToShow());
    }

    if (propName == null || propName.equals(SessionProperties.IPropertyNames.FONT_INFO))
    {
      FontInfo fi = props.getFontInfo();
      if (fi != null)
      {
        _sqlEntry.setFont(fi.createFont());
      }
    }

    if (propName == null || propName.equals(SessionProperties.IPropertyNames.SQL_ENTRY_HISTORY_SIZE)
              || propName.equals(SessionProperties.IPropertyNames.LIMIT_SQL_ENTRY_HISTORY_SIZE))
    {
      if (props.getLimitSQLEntryHistorySize())
      {
        _sqlCombo.setMaxMemoryCount(props.getSQLEntryHistorySize());
      }
      else
      {
        _sqlCombo.setMaxMemoryCount(MemoryComboBox.NO_MAX);
      }
View Full Code Here

    setLayout(new BorderLayout());

    _nbrRows.setColumns(8);

    final SessionProperties props = _session.getProperties();
    _sqlCombo = new SQLHistoryComboBox(props.getSQLShareHistory());
    _sqlCombo.setEditable(false);
    if (_sqlCombo.getItemCount() > 0)
    {
      _sqlCombo.setSelectedIndex(_sqlCombo.getItemCount() - 1);
    }
View Full Code Here

   private class SetAutoCommitTask implements Runnable {
       
        public void run() {
            final ISQLConnection conn = _session.getSQLConnection();
            final SessionProperties props = _session.getProperties();
            if (conn != null)
            {
                boolean auto = true;
                try
                {
                    auto = conn.getAutoCommit();
                }
                catch (SQLException ex)
                {
                    s_log.error("Error with transaction control", ex);
                    _session.showErrorMessage(ex);
                }
                try
                {
                    conn.setAutoCommit(props.getAutoCommit());
                }
                catch (SQLException ex)
                {
                    props.setAutoCommit(auto);
                    _session.showErrorMessage(ex);
                }
            }       
        }
View Full Code Here

           return;
       }

      String lastExecutedStatement = null;
      int statementCount = 0;
      final SessionProperties props = _session.getProperties();
      try
      {
         final ISQLConnection conn = _session.getSQLConnection();
         _stmt = conn.createStatement();

         try
         {
            if(props.getSQLUseFetchSize() && props.getSQLFetchSize() > 0)
            {
              setFetchSize(props);
            }
            
            
            final boolean correctlySupportsMaxRows = conn.getSQLMetaData()
                  .correctlySupportsSetMaxRows();
            if (correctlySupportsMaxRows && props.getSQLLimitRows())
            {
               setMaxRows(props);
            }

            if(_tokenizer.getQueryCount() == 0)
            {
               throw new IllegalArgumentException("No SQL selected for execution.");
            }

            _currentQueryIndex = 0;

            // Process each individual query.
            boolean maxRowsHasBeenSet = correctlySupportsMaxRows;
            int processedStatementCount = 0;
            statementCount = _tokenizer.getQueryCount();

            _handler.sqlStatementCount(statementCount);

            while (_tokenizer.hasQuery() && !_stopExecution)
            {
               String querySql = _tokenizer.nextQuery();
               if (querySql != null)
               {
                  ++processedStatementCount;
                  if (_handler != null)
                  {
                     _handler.sqlToBeExecuted(querySql);
                  }

                  // Some driver don't correctly support setMaxRows. In
                  // these cases use setMaxRows only if this is a
                  // SELECT.
                  if (!correctlySupportsMaxRows
                        && props.getSQLLimitRows())
                  {
                     if (isSelectStatement(querySql))
                     {
                        if (!maxRowsHasBeenSet)
                        {
                           setMaxRows(props);
                           maxRowsHasBeenSet = true;
                        }
                     }
                     else if (maxRowsHasBeenSet)
                     {
                        _stmt.close();
                        _stmt = conn.createStatement();
                        maxRowsHasBeenSet = false;
                     }
                  }
                  try
                  {
                     lastExecutedStatement = querySql;

                     if (!processQuery(querySql, processedStatementCount, statementCount))
                     {
                        break;
                     }
                  }
                  catch (SQLException ex)
                  {
                     // If the user has cancelled the query, don't bother logging
                     // an error message.  It is likely that the cancel request
                     // interfered with the attempt to fetch results from the
                     // ResultSet, which is to be expected when the Statement is
                     // closed.  So, let's not bug the user with obvious error
                     // messages that we can do nothing about.
                     if (_stopExecution) {
                         break;
                     } else {
                         if (props.getAbortOnError())
                         {
                            throw ex;
                         }
                         else
                         {
                            if(1 < statementCount)
                            {
                               handleError(ex, "Error occured in:\n" + lastExecutedStatement);
                            }
                            else
                            {
                               handleError(ex, null);
                            }
                         }
                     }
                  }
               }
            }

         }
         finally
         {
            try
            {
               _stmt.close();
            }
            finally
            {
               _stmt = null;
            }
         }
      }
      catch (Throwable ex)
      {
         if(props.getAbortOnError() && 1 < statementCount)
         {
            handleError(ex, "Error occured in:\n" + lastExecutedStatement);
         }
         else
         {
View Full Code Here

      || propName.equals(SessionProperties.IPropertyNames.META_DATA_OUTPUT_CLASS_NAME)
      || propName.equals(SessionProperties.IPropertyNames.TABLE_CONTENTS_OUTPUT_CLASS_NAME)
      || propName.equals(SessionProperties.IPropertyNames.SQL_RESULTS_OUTPUT_CLASS_NAME)
      || propName.equals(SessionProperties.IPropertyNames.OBJECT_TAB_PLACEMENT))
    {
      final SessionProperties props = _session.getProperties();

      Iterator<ObjectTreeTabbedPane> it = _tabbedPanes.values().iterator();
      while (it.hasNext())
      {
        ObjectTreeTabbedPane pane = it.next();

        if (propName == null
          || propName.equals(SessionProperties.IPropertyNames.META_DATA_OUTPUT_CLASS_NAME)
          || propName.equals(SessionProperties.IPropertyNames.TABLE_CONTENTS_OUTPUT_CLASS_NAME)
          || propName.equals(SessionProperties.IPropertyNames.SQL_RESULTS_OUTPUT_CLASS_NAME))
        {
          pane.rebuild();
        }
        if (propName == null
          || propName.equals(SessionProperties.IPropertyNames.OBJECT_TAB_PLACEMENT))
        {
          pane.getTabbedPane().setTabPlacement(props.getObjectTabPlacement());
        }
      }
    }
  }
View Full Code Here



  private void setupTabbedPane(ObjectTreeTabbedPane pane)
  {
    final SessionProperties props = _session.getProperties();
    pane.rebuild();
    final JTabbedPane p = pane.getTabbedPane();
    p.setTabPlacement(props.getObjectTabPlacement());
    p.addChangeListener(_tabPnlListener);
  }
View Full Code Here

     return result;
  }

  public static SessionProperties getEasyMockSessionProperties(String sep,
        String solComment, boolean removeMultLineComments) {
     SessionProperties result = createMock(SessionProperties.class);
     expect(result.getSQLStatementSeparator()).andReturn(sep).anyTimes();
     expect(result.getStartOfLineComment()).andReturn(solComment).anyTimes();
     expect(result.getRemoveMultiLineComment()).andReturn(removeMultLineComments)
                                               .anyTimes();
     expect(result.clone()).andReturn(result).anyTimes();
     replay(result);
     return result;
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.client.session.properties.SessionProperties

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.