Examples of ConnectionResource


Examples of org.opensolaris.opengrok.jdbc.ConnectionResource

            File directory, Repository repository)
        throws HistoryException, SQLException
    {
        final Map<String, Date> map = new HashMap<>();

        final ConnectionResource conn =
                connectionManager.getConnectionResource();
        try {
            PreparedStatement ps = conn.getStatement(GET_LAST_MODIFIED_TIMES);
            ps.setString(1, toUnixPath(repository.getDirectoryName()));
            ps.setString(2, getSourceRootRelativePath(directory));
            try (ResultSet rs = ps.executeQuery()) {
                while (rs.next()) {
                    map.put(rs.getString(1), rs.getTimestamp(2));
View Full Code Here

Examples of org.opensolaris.opengrok.jdbc.ConnectionResource

    /**
     * Helper for {@link #clear(Repository)}.
     */
    private void clearHistoryForRepository(Repository repository)
            throws SQLException {
        final ConnectionResource conn =
                connectionManager.getConnectionResource();
        try {
            try (PreparedStatement ps = conn.prepareStatement(
                         getQuery("clearRepository"))) {
                ps.setInt(1, getRepositoryId(conn, repository));
                ps.execute();
                conn.commit();
            }
        } finally {
            connectionManager.releaseConnection(conn);
        }
    }
View Full Code Here

Examples of org.opensolaris.opengrok.jdbc.ConnectionResource

        int fileId = files.get(repo_path);
        for (HistoryEntry entry : hist.getHistoryEntries()) {
            retry:
            for (int i = 0;; i++) {
               
                final ConnectionResource conn =
                        connectionManager.getConnectionResource();
               
                addFilemove = conn.getStatement(ADD_FILEMOVE);
                addFilechange = conn.getStatement(ADD_FILECHANGE);
               
                try {
                    int changesetId = getIdForRevision(entry.getRevision(),
                        getRepositoryId(conn, repository));

                    /*
                     * If the file exists in the changeset, store it in
                     * the table tracking moves of the file when it had
                     * one of its precedent names so it can be found
                     * when performing historyget on directory.
                     */
                    if (entry.getFiles().contains(repo_path)) {
                        addFilechange.setInt(1, changesetId);
                        addFilechange.setInt(2, fileId);
                        addFilechange.executeUpdate();
                    } else {
                        addFilemove.setInt(1, changesetId);
                        addFilemove.setInt(2, fileId);
                        addFilemove.executeUpdate();
                    }

                    conn.commit();
                    break retry;
                } catch (SQLException sqle) {
                    handleSQLException(sqle, i);
                    conn.rollback();
                } finally {
                    connectionManager.releaseConnection(conn);
                }
            }
        }
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.