Closes database Statement.
No exception will be thrown even if occurred during closing,
instead, the exception will be logged at warning level.

@param st	the Statement that need to be closed
971870
public static void closeStatement(Statement st){
		if (st != null) {
			try {
				st.close();
			} catch (Exception e) {
				log.warn("Exception when closing database statement.", e);
			}
		}
	}
907373
@Override
  public void close() throws IOException {
    try {
      try {
        if (this.failed && this.conn != null) {
          this.conn.rollback();
        }
      } finally {
        if (this.conn != null) {
          this.conn.close();
        }
      }
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
  }
1189756
@Override
	public void close() throws IOException {
		try {
			resultSet.close();
		} catch (SQLException se) {
			LOG.info("Inputformat couldn't be closed - " + se.getMessage());
		} catch (NullPointerException npe) {
		}
		try {
			statement.close();
		} catch (SQLException se) {
			LOG.info("Inputformat couldn't be closed - " + se.getMessage());
		} catch (NullPointerException npe) {
		}
		try {
			dbConn.close();
		} catch (SQLException se) {
			LOG.info("Inputformat couldn't be closed - " + se.getMessage());
		} catch (NullPointerException npe) {
		}
	}
880195
public static void close(Object... objsToClose) {
		for (Object obj : objsToClose) {
			if (obj instanceof AutoCloseable) {
				IoUtil.close((AutoCloseable) obj);
			} else if (obj instanceof Closeable) {
				IoUtil.close((Closeable) obj);
			} else {
				try {
					if (obj != null) {
						if (obj instanceof ResultSet) {
							((ResultSet) obj).close();
						} else if (obj instanceof Statement) {
							((Statement) obj).close();
						} else if (obj instanceof PreparedStatement) {
							((PreparedStatement) obj).close();
						} else if (obj instanceof Connection) {
							((Connection) obj).close();
						} else {
							log.warn("Object {} not a ResultSet or Statement or PreparedStatement or Connection!", obj.getClass().getName());
						}
					}
				} catch (SQLException e) {
					// ignore
				}
			}
		}
	}
283191
@Override
    public void close() {
        // Check for previous closed.
        if (!closed) {
            try {
                if (resultSet != null) {
                    resultSet.close();
                }
            } catch (final Exception e) {
                logger.warn("Could not close result set.", e);
            }
            if (statementCloseable && statement != null) {
                try {
                    statement.close();
                } catch (final Exception e) {
                    logger.warn("Could not close statement.", e);
                }
            }
        }
        // Assume closed even if it fails.
        closed = true;
    }
1324985
public void closeSession() throws HibernateException
    {
        Session s = threadSession.get();
        threadSession.set(null);
        if (s != null)
        {
            s.close();
        }
        
        Transaction tx = threadTransaction.get();
        if (tx != null)
        {
            threadTransaction.set(null);
            //log warning todo
        }
    }
83628
public static void close(Connection conn, Statement stmt, ResultSet rs) {
        close(rs);
        close(stmt);
        close(conn);
    }
241329
@Override
	public void close() throws IOException {
		if (upload != null) {
			flush();
			// close the connection
			try {
				upload.close();
			} catch (SQLException e) {
				LOG.info("JDBC statement could not be closed: " + e.getMessage());
			} finally {
				upload = null;
			}
		}

		if (dbConn != null) {
			try {
				dbConn.close();
			} catch (SQLException se) {
				LOG.info("JDBC connection could not be closed: " + se.getMessage());
			} finally {
				dbConn = null;
			}
		}
	}
982439
public static void close(ResultSet rs) {
		Statement st = null;
		Connection con = null;
		try {
			try {
				if (rs != null) {
					st = rs.getStatement();
					rs.close();
				}
			} finally {
				try {
					if (st != null) {
						con = st.getConnection();
						st.close();
					}
				} finally {
					if (con != null) {
						con.close();
					}
				}
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
445225
public void close(boolean closeConnection) throws SQLException {
        if (closeConnection) {
            resultSet.getStatement().getConnection().close();
        } else {
            resultSet.close();
        }

        finished = true;
    }
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);}}
		}
	}
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);
			}
		}
	}
174827
private void cleanConnectionClose(Connection connection, Statement stmt) {
        try {
            // clean close
            if (connection != null) {
                connection.rollback();
            }

            if (stmt != null) {
                stmt.close();
            }

            if (connection != null) {
                connection.close();
            }
        } catch (SQLException e1) {
            e1.printStackTrace();
        }
    }
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);
            }
        }
    }
536933
public void closeAll(CmsDbContext dbc, Connection con, Statement stmnt, ResultSet res) {

        // NOTE: we have to close Connections/Statements that way, because a dbcp PoolablePreparedStatement
        // is not a DelegatedStatement; for that reason its not removed from the trace of the connection when it is closed.
        // So, the connection tries to close it again when the connection is closed itself;
        // as a result there is an error that forces the connection to be destroyed and not pooled

        if (dbc == null) {
            LOG.error(Messages.get().getBundle().key(Messages.LOG_NULL_DB_CONTEXT_0));
        }

        try {
            // first, close the result set
            if (res != null) {
                res.close();
            }
        } catch (SQLException e) {
            LOG.debug(e.getLocalizedMessage(), e);
        } finally {
            res = null;
        }

        try {
            // close the statement
            if (stmnt != null) {
                stmnt.close();
            }
        } catch (SQLException e) {
            LOG.debug(e.getLocalizedMessage(), e);
        } finally {
            stmnt = null;
        }

        try {
            // close the connection
            if ((con != null) && !con.isClosed()) {
                con.close();
            }
        } catch (SQLException e) {
            LOG.debug(e.getLocalizedMessage(), e);
        } finally {
            con = null;
        }

    }
718593
@Override
  public void close() throws SQLException {
    super.close();
    if (connection == null || connection.pooledConnection == null
        || connection.pooledConnection.noStmtEventListeners()) {
      return;
    }
    connection.pooledConnection.fireStatementClosed(this);
    connection = 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);
        }
	}