Search in sources :

Example 1 with RecordScan

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

the class SqlTableScan method read.

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

Example 2 with RecordScan

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

the class ParosTableScan method build.

private RecordScan build(ResultSet rs) throws DatabaseException {
    try {
        RecordScan scan = null;
        if (rs.next()) {
            scan = new RecordScan(rs.getInt(SCANID), rs.getString(SCANNAME), rs.getDate(SCANTIME));
        }
        rs.close();
        return scan;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    }
}
Also used : RecordScan(org.parosproxy.paros.db.RecordScan) SQLException(java.sql.SQLException) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 3 with RecordScan

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

the class SqlTableScan method build.

private RecordScan build(ResultSet rs) throws DatabaseException {
    try {
        RecordScan scan = null;
        if (rs.next()) {
            scan = new RecordScan(rs.getInt(SCANID), rs.getString(SCANNAME), rs.getDate(SCANTIME));
        }
        rs.close();
        return scan;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    }
}
Also used : RecordScan(org.parosproxy.paros.db.RecordScan) SQLException(java.sql.SQLException) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Aggregations

SQLException (java.sql.SQLException)3 DatabaseException (org.parosproxy.paros.db.DatabaseException)3 RecordScan (org.parosproxy.paros.db.RecordScan)3 ResultSet (java.sql.ResultSet)1