Close a ResultSet

@param rs a database ResultSet object
710
public static void closeResultSet(final ResultSet rs) {
        if (rs == null) {
            return;
        }

        try {
            rs.close();
        } catch (Exception e) {
            if (LOG.isWarnEnabled()) LOG.warn("Error closing ResultSet: " + rs, e);
        }
    }
38791
@Override
  public void close() throws SQLException
  {
    logger.debug(" public void close()");

    if (isClosed)
    {
      // No exception is raised even if the connection is closed.
      return;
    }

    isClosed = true;
    try
    {
      if (sfSession != null)
      {
        sfSession.close();
        sfSession = null;
      }

      // make sure to close all created statements
      synchronized (openStatements)
      {
        for (Statement stmt : openStatements)
        {
          if (stmt != null && !stmt.isClosed())
          {
            if (stmt.isWrapperFor(SnowflakeStatementV1.class))
            {
              stmt.unwrap(SnowflakeStatementV1.class).close(false);
            }
            else
            {
              stmt.close();
            }
          }
        }
        openStatements.clear();
      }
    }
    catch (SFException ex)
    {
      throw new SnowflakeSQLException(
          ex.getCause(), ex.getSqlState(), ex.getVendorCode(), ex.getParams());
    }
  }
193976
function clearDatabase(tx, resultSet) {
    var sql = "delete from clicks"
    tx.executeSql(sql, null, null, sqlError);
}
1165835
public static void closeResultSetStatement(ResultSet resultSet, String sql) {
		if (resultSet != null) {
			try {
				resultSet.getStatement().close();
			} catch (SQLException e) {
				log.log(Level.WARNING, "Failed to close SQL ResultSet: " + sql,
						e);
			}
		}
	}
673248
public static void closeResultSet(ResultSet rs){
		if (rs != null) {
			try {
				rs.close();
			} catch (Exception e) {
				log.warn("Exception when closing database result set.", e);
			}
		}
	}
1088902
public void close(ResultSet rs, Statement st, Connection conn) {
		if (rs != null) {try {rs.close();} catch (SQLException e) {LogKit.error(e.getMessage(), e);}}
		if (st != null) {try {st.close();} catch (SQLException e) {LogKit.error(e.getMessage(), e);}}
		
		if (threadLocal.get() == null) {	// in transaction if conn in threadlocal
			if (conn != null) {try {conn.close();}
			catch (SQLException e) {throw new ActiveRecordException(e);}}
		}
	}
59868
public synchronized void close(final boolean forceClose) throws SQLException {
        Collection<SQLException> exceptions = new LinkedList<>();
        MasterVisitedManager.clear();
        exceptions.addAll(closeResultSets());
        exceptions.addAll(closeStatements());
        if (!stateHandler.isInTransaction() || forceClose) {
            exceptions.addAll(releaseConnections(forceClose));
        }
        stateHandler.doNotifyIfNecessary();
        throwSQLExceptionIfNecessary(exceptions);
    }
371292
@Override
    public void close() {
        val bk = this.bookKeeper.getAndSet(null);
        if (bk != null) {
            try {
                bk.close();
            } catch (Exception ex) {
                log.error("Unable to close BookKeeper client.", ex);
            }
        }
    }
1032852
private void closeResultSet(ResultSet rs) {
    if (rs != null) {
      try {
        rs.close();
      } catch (SQLException e) {
        logger.error("Could not close JDBC ResultSet", e);
      } catch (Throwable e) {
        logger.error("Unexpected exception on closing JDBC ResultSet", e);
      }
    }
  }
818692
public Map<String, Object> convertToMap(ResultSet rs) throws SQLException{
		return convertToMap(rs, null);
	}
486601
final void closeAndRemoveAllDatabaseHandles() {
        for (Database databaseHandle : this.databaseHandles) {
            try {
                databaseHandle.close();
            } catch (EnvironmentFailureException | IllegalStateException ex) {
                LOGGER.log(Level.SEVERE,
                        "Error closing databases", ex);
            }
        }
        this.databaseHandles.clear();
    }
1031271
static void closeQuietly(ResultSet rs) {
        try {
            if (rs != null && !rs.isClosed()) {
                rs.close();
                log.debug("closed {}", rs);
            }
        } catch (SQLException e) {
            log.debug(e.getMessage(), e);
        } catch (RuntimeException e) {
            log.debug(e.getMessage(), e);
        }
    }
157813
@Override
    public void close() {
        if (this.closed.compareAndSet(false, true)) {
            RocksDB db = this.database.get();
            if (db != null) {
                db.close();
                this.database.set(null);
            }

            if (this.writeOptions != null) {
                this.writeOptions.close();
            }

            if (this.databaseOptions != null) {
                this.databaseOptions.close();
            }

            clear(false);
            log.info("{}: Closed.", this.logId);

            Consumer<String> callback = this.closeCallback;
            if (callback != null) {
                Callbacks.invokeSafely(callback, this.id, null);
            }
        }
    }
209952
@Override
	public void close(boolean compact, boolean cleanup) {
		// ZAP: Added statement.
		logger.debug("close");
	    if (databaseServer == null) {
	    	return;
	    }

	    super.close(compact, cleanup);
	    
	    try {
	        // ZAP: Added if block.
	        if (cleanup) {
    		    // perform clean up
    	        getTableHistory().deleteTemporary();
	        }
        } catch (Exception e) {
	        // ZAP: Changed to log the exception.
            logger.error(e.getMessage(), e);
        }
	}
107432
private void formatResultSet(ResultSet r) {

        if (r == null) {
            String[] g = new String[1];

            g[0] = "Result";

            gResult.setHead(g);

            g[0] = "(empty)";

            gResult.addRow(g);

            return;
        }

        try {
            ResultSetMetaData m         = r.getMetaData();
            int               col       = m.getColumnCount();
            Object[]          h         = new Object[col];
            boolean[]         isVarChar = new boolean[col];

            for (int i = 1; i <= col; i++) {
                h[i - 1] = m.getColumnLabel(i);
                isVarChar[i - 1] = (m.getColumnType(i)
                                    == java.sql.Types.VARCHAR);
            }

            gResult.setHead(h);

            while (r.next()) {
                for (int i = 1; i <= col; i++) {
                    try {
                        h[i - 1] = r.getObject(i);

                        if (r.wasNull()) {
                            h[i - 1] = (isVarChar[i - 1] ? NULL_STR
                                                         : null);
                        }
                    } catch (SQLException e) {}
                }

                gResult.addRow(h);
            }

            r.close();
        } catch (SQLException e) {

            //  Added: (weconsultants@users)
            CommonSwing.errorMessage(e);
        }
    }
996332
private void releaseResultset() {
		TableModel model = tblQueryResult.getModel();
		if (model == null)
			return;
		if (!(model instanceof IncrementalResultSetTableModel))
			return;
		IncrementalResultSetTableModel imodel = (IncrementalResultSetTableModel) model;
		imodel.close();
	}
1101050
@Override
    public void close() throws SQLException
    {
        try
        {
            isClosed = true;
            JDBC4ClientConnectionPool.dispose(NativeConnection);
        }
        catch(Exception x)
        {
            throw SQLError.get(x);
        }
    }