Search in sources :

Example 1 with RecordTag

use of org.parosproxy.paros.db.RecordTag in project zaproxy by zaproxy.

the class SqlTableTag method getTagsForHistoryID.

/* (non-Javadoc)
	 * @see org.parosproxy.paros.db.paros.TableTag#getTagsForHistoryID(long)
	 */
@Override
public List<RecordTag> getTagsForHistoryID(long historyId) throws DatabaseException {
    SqlPreparedStatementWrapper psGetTagsForHistoryId = null;
    try {
        psGetTagsForHistoryId = DbSQL.getSingleton().getPreparedStatement("tag.ps.gettagsforhid");
        List<RecordTag> result = new ArrayList<>();
        psGetTagsForHistoryId.getPs().setLong(1, historyId);
        try (ResultSet rs = psGetTagsForHistoryId.getPs().executeQuery()) {
            while (rs.next()) {
                result.add(new RecordTag(rs.getLong(TAGID), rs.getLong(TAGID), rs.getString(TAG)));
            }
        }
        return result;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    } finally {
        DbSQL.getSingleton().releasePreparedStatement(psGetTagsForHistoryId);
    }
}
Also used : RecordTag(org.parosproxy.paros.db.RecordTag) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 2 with RecordTag

use of org.parosproxy.paros.db.RecordTag in project zaproxy by zaproxy.

the class SqlTableTag method read.

/* (non-Javadoc)
	 * @see org.parosproxy.paros.db.paros.TableTag#read(long)
	 */
@Override
public synchronized RecordTag read(long tagId) throws DatabaseException {
    SqlPreparedStatementWrapper psRead = null;
    try {
        psRead = DbSQL.getSingleton().getPreparedStatement("tag.ps.read");
        psRead.getPs().setLong(1, tagId);
        try (ResultSet rs = psRead.getPs().executeQuery()) {
            RecordTag result = build(rs);
            return result;
        }
    } catch (SQLException e) {
        throw new DatabaseException(e);
    } finally {
        DbSQL.getSingleton().releasePreparedStatement(psRead);
    }
}
Also used : RecordTag(org.parosproxy.paros.db.RecordTag) SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 3 with RecordTag

use of org.parosproxy.paros.db.RecordTag in project zaproxy by zaproxy.

the class ParosTableTag method getTagsForHistoryID.

/* (non-Javadoc)
	 * @see org.parosproxy.paros.db.paros.TableTag#getTagsForHistoryID(long)
	 */
@Override
public synchronized List<RecordTag> getTagsForHistoryID(long historyId) throws DatabaseException {
    try {
        List<RecordTag> result = new ArrayList<>();
        psGetTagsForHistoryId.setLong(1, historyId);
        try (ResultSet rs = psGetTagsForHistoryId.executeQuery()) {
            while (rs.next()) {
                result.add(new RecordTag(rs.getLong(TAGID), rs.getLong(TAGID), rs.getString(TAG)));
            }
        }
        return result;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    }
}
Also used : RecordTag(org.parosproxy.paros.db.RecordTag) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Aggregations

ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 DatabaseException (org.parosproxy.paros.db.DatabaseException)3 RecordTag (org.parosproxy.paros.db.RecordTag)3 ArrayList (java.util.ArrayList)2