class PhasingPollTable extends EntityDbTable<PhasingPoll> {

    public int getAccountPhasedTransactionCount(long accountId, int height) throws SQLException {
        try (Connection con = getDatabaseManager().getDataSource().getConnection();
             PreparedStatement pstmt = con.prepareStatement("SELECT COUNT(*) FROM transaction, phasing_poll " +
                 " LEFT JOIN phasing_poll_result ON phasing_poll.id = phasing_poll_result.id " +
                 " WHERE phasing_poll.id = transaction.id AND (transaction.sender_id = ? OR transaction.recipient_id = ?) " +
                 " AND phasing_poll_result.id IS NULL " +
                 " AND phasing_poll.finish_height > ?")) {
            int i = 0;
            pstmt.setLong(++i, accountId);
            pstmt.setLong(++i, accountId);
            pstmt.setInt(++i, height);
            try (ResultSet rs = pstmt.executeQuery()) {
                rs.next();
                return rs.getInt(1);
            }
        }
    }

    @Inject public  PhasingPollTable(Blockchain blockchain);

}