public override void WritePacket(MySqlStreamWriter writer)
 {
     writer.ReserveHeader();
     writer.WriteUnsigned4(_statement_id);
     writer.WriteUnsigned2((uint)_param_id);
     WriteValueByType(writer, _data);
 }
 public static PacketHeader Write(MySqlStreamWriter writer, uint stmtId)
 {
     //for those who don't want to alloc an new packet
     //just write it into a stream
     writer.ReserveHeader();
     writer.WriteByte((byte)Command.STMT_CLOSE);
     writer.WriteUnsigned4(stmtId);
     var h = new PacketHeader(writer.OnlyPacketContentLength, writer.IncrementPacketNumber());
     writer.WriteHeader(h);
     return h;
 }
 public static PacketHeader Write(MySqlStreamWriter writer, uint stmtId)
 {
     writer.ReserveHeader();
     writer.WriteByte((byte)Command.STMT_RESET);
     writer.WriteUnsigned4(stmtId);
     var _header = new PacketHeader(writer.OnlyPacketContentLength, writer.IncrementPacketNumber());
     writer.WriteHeader(_header);
     return _header;
 }
 public override void WritePacket(MySqlStreamWriter writer)
 {
     writer.ReserveHeader();//allocate header
     if (protocol41)
     {
         writer.WriteUnsigned4(clientFlags);
         writer.WriteUnsigned4(maxPacketSize);
         writer.WriteUnsigned1(charsetNumber);
         writer.WriteFiller(23);
         writer.WriteNullTerminatedString(user);
         writer.WriteLengthCodedBuffer(scrambleBuff);
         writer.WriteNullTerminatedString(database);
     }
     else
     {
         writer.WriteUnsigned2(clientFlags);
         writer.WriteUnsigned3(maxPacketSize);
         writer.WriteNullTerminatedString(user);
         writer.WriteBuffer(scrambleBuff);
         if (database != null && database.Length > 0)
         {
             writer.WriteFiller(1);
             writer.WriteBuffer(Encoding.ASCII.GetBytes(database));
         }
     }
     _header = new PacketHeader(writer.OnlyPacketContentLength, writer.IncrementPacketNumber());
     writer.WriteHeader(_header);
 }