class MySQLTextResultSetRowPacket implements MySQLPacket {

    @Override
    public void write(final MySQLPacketPayload payload) {
        for (Object each : data) {
            if (null == each) {
                payload.writeInt1(NULL);
            } else {
                if (each instanceof byte[]) {
                    payload.writeBytesLenenc((byte[]) each);
                } else if ((each instanceof Timestamp) && (0 == ((Timestamp) each).getNanos())) {
                    payload.writeStringLenenc(each.toString().split("\\.")[0]);
                } else if (each instanceof BigDecimal) {
                    payload.writeStringLenenc(((BigDecimal) each).toPlainString());
                } else if (each instanceof Boolean) {
                    payload.writeBytesLenenc((Boolean) each ? new byte[]{1} : new byte[]{0});
                } else {
                    payload.writeStringLenenc(each.toString());
                }
            }
        }
    }

    public  MySQLTextResultSetRowPacket(final MySQLPacketPayload payload, final int columnCount);

}