class ResponsePacketBuilder {

    public static Collection<DatabasePacket<?>> buildQueryResponsePackets(final QueryResponse queryResponse) {
        Collection<DatabasePacket<?>> result = new LinkedList<>();
        int sequenceId = 0;
        List<QueryHeader> queryHeader = queryResponse.getQueryHeaders();
        result.add(new MySQLFieldCountPacket(++sequenceId, queryHeader.size()));
        for (QueryHeader each : queryHeader) {
            result.add(new MySQLColumnDefinition41Packet(++sequenceId, getColumnFieldDetailFlag(each), each.getSchema(), each.getTable(), each.getTable(),
                    each.getColumnLabel(), each.getColumnName(), each.getColumnLength(), MySQLColumnType.valueOfJDBCType(each.getColumnType()), each.getDecimals()));
        }
        result.add(new MySQLEofPacket(++sequenceId));
        return result;
    }

}