MySQLPacketError.decode constructor

MySQLPacketError.decode(
  1. Uint8List buffer
)

Implementation

factory MySQLPacketError.decode(Uint8List buffer) {
  final byteData = ByteData.sublistView(buffer);

  int offset = 0;

  final header = byteData.getUint8(offset);
  offset += 1;

  final errorCode = byteData.getInt2(offset);
  offset += 2;

  // skip sql_state_marker and sql_state
  offset += 6;

  // error message
  final errorMessage = buffer.getUtf8StringEOF(offset);

  return MySQLPacketError(
    header: header,
    errorCode: errorCode,
    errorMessage: errorMessage,
  );
}