class PacmanRedshiftRepository {

    public int count(String query) {
        int result = 0;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        try {
            conn = getConnection();
            stmt = conn.createStatement();
            rs = stmt.executeQuery(query);
            while (rs.next()) {
                result = rs.getInt("count");
            }
            rs.close();
            stmt.close();
            conn.close();
        } catch (Exception ex) {
            LOGGER.error(AssetConstants.ERROR_COUNT , ex);
        } finally {
            try {
                if (rs != null) {
                    rs.close();
                }
            } catch (Exception ex) {
                LOGGER.error(AssetConstants.ERROR_COUNT , ex);
            }
            try {
                if (stmt != null) {
                    stmt.close();
                }
            } catch (Exception ex) {
                LOGGER.error(AssetConstants.ERROR_COUNT , ex);
            }
            try {
                if (conn != null) {
                    conn.close();
                }
            } catch (Exception ex) {
                LOGGER.error(AssetConstants.ERROR_COUNT , ex);
            }
        }
        return result;
    }

}