sendBuffer method
Implementation
Future sendBuffer(Buffer buffer) {
if (buffer.length > _maxPacketSize) {
throw MySqlClientError(
'Buffer length (${buffer.length}) bigger than maxPacketSize ($_maxPacketSize)');
}
if (_useCompression) {
_headerBuffer[0] = buffer.length & 0xFF;
_headerBuffer[1] = (buffer.length & 0xFF00) >> 8;
_headerBuffer[2] = (buffer.length & 0xFF0000) >> 16;
_headerBuffer[3] = ++_packetNumber;
var encodedHeader = zlib.encode(_headerBuffer.list);
var encodedBuffer = zlib.encode(buffer.list);
_compressedHeaderBuffer
.writeUint24(encodedHeader.length + encodedBuffer.length);
_compressedHeaderBuffer.writeByte(++_compressedPacketNumber);
_compressedHeaderBuffer.writeUint24(4 + buffer.length);
return _socket.writeBuffer(_compressedHeaderBuffer);
} else {
_log.fine('sendBuffer header');
return _sendBufferPart(buffer, 0);
}
}