Examples of ISQLConnection


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

  @Override
  protected PreparedStatement createStatement() throws SQLException
  {
    final ISession session = getSession();

    ISQLConnection conn = session.getSQLConnection();

    String sqlStatement = getSqlStatement();
    String[] bindValues = getBindValues();

    if (s_log.isDebugEnabled())
    {
      s_log.debug("Running SQL for index source tab: " + sqlStatement);
      s_log.debug("With the following bind variable values: ");
      int parameterIndex = 1;
      for (String bindValue : bindValues)
      {
        s_log.debug("[" + (parameterIndex++) + "] => '" + bindValue + "'");
      }
    }
    PreparedStatement pstmt = conn.prepareStatement(sqlStatement);

    int parameterIndex = 1;
    for (String bindValue : bindValues)
    {
      pstmt.setString(parameterIndex++, bindValue);
View Full Code Here

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

      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
                  {
View Full Code Here

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

                                               ObjectTreeNode parentNode)
    throws SQLException
  {
    final List<ObjectTreeNode> childNodes = new ArrayList<ObjectTreeNode>();
    final IDatabaseObjectInfo parentDbinfo = parentNode.getDatabaseObjectInfo();
    final ISQLConnection conn = session.getSQLConnection();
    final String catalogName = parentDbinfo.getCatalogName();
    final String schemaName = parentDbinfo.getSchemaName();

      ObjFilterMatcher filterMatcher = new ObjFilterMatcher(session.getProperties());

      IUDTInfo[] udts =
         conn.getSQLMetaData().getUDTs(catalogName, schemaName, filterMatcher.getSqlLikeMatchString(), null);

    for (int i = 0; i < udts.length; ++i)
    {
         if(filterMatcher.matches(udts[i].getSimpleName()))
         {
View Full Code Here

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

  public static ISession getEasyMockSession(ISQLDatabaseMetaData md, boolean replay)
  {
    ISession session = null;
    try
    {
      ISQLConnection con = FwTestUtil.getEasyMockSQLConnection();
      session = getEasyMockSession(md, con, false);
      if (replay)
      {
        replay(session);
      }
View Full Code Here

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

     return getEasyMockSession(md, true);
  }

  public static ISession getEasyMockSession(ISQLDatabaseMetaData md,
        ResultSet rs) throws SQLException {
     ISQLConnection con = FwTestUtil.getEasyMockSQLConnection(rs);
     ISession session = getEasyMockSession(md, con, false);
     replay(session);
     return session;
  }
View Full Code Here

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

      expect(con.createStatement()).andReturn(stmt);
      expect(con.createStatement(ResultSet.TYPE_FORWARD_ONLY,
                                 ResultSet.CONCUR_READ_ONLY)).andReturn(stmt);
      replay(con);

      ISQLConnection sqlCon = createNiceMock(ISQLConnection.class);
      expect(sqlCon.getConnection()).andReturn(con);
      replay(sqlCon);

      return sqlCon;
   }
View Full Code Here

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

      if (propName == null ||
        propName.equals(ISQLConnection.IPropertyNames.CATALOG))
      {
        if (_catalogsCmb != null)
        {
          final ISQLConnection conn = _session.getSQLConnection();
          if (!StringUtilities.areStringsEqual(conn.getCatalog(), _catalogsCmb.getSelectedCatalog()))
          {
            _catalogsCmb.setSelectedCatalog(conn.getCatalog());
          }
        }
      }
    }
    catch (SQLException e)
View Full Code Here

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

  @Override
  protected PreparedStatement createStatement() throws SQLException {
    final ISession session = getSession();
    final IDatabaseObjectInfo doi = getDatabaseObjectInfo();

    ISQLConnection conn = session.getSQLConnection();
    PreparedStatement pstmt = conn.prepareStatement(SQL);
    pstmt.setString(1, doi.getSchemaName());
    pstmt.setString(2, doi.getSimpleName());
    return pstmt;
  }
View Full Code Here

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

   */
  public List<ObjectTreeNode> createChildren(ISession session, ObjectTreeNode parentNode)
    throws SQLException
  {
    final List<ObjectTreeNode> childNodes = new ArrayList<ObjectTreeNode>();
    final ISQLConnection conn = session.getSQLConnection();
    final SQLDatabaseMetaData md = session.getSQLConnection().getSQLMetaData();
    final IDatabaseObjectInfo parentDbinfo = parentNode.getDatabaseObjectInfo();
    final String schemaName = parentDbinfo.getSchemaName();

    PreparedStatement pstmt = conn.prepareStatement(SQL);
    try
    {
      ResultSet rs = pstmt.executeQuery();
      while (rs.next())
      {
View Full Code Here

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

            return;
        }
       
        ITableInfo tableInfo = (ITableInfo) dbObjs[0];
       
        ISQLConnection conn = _session.getSQLConnection();
        SQLDatabaseMetaData metaData = conn.getSQLMetaData();
       
        try {
            ResultSetDataSet rsds =
                metaData.getIndexInfo(tableInfo, indexColumnIndices, false);
            String indexName = "";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.