DataRowMessage.parse constructor

  1. @internal
DataRowMessage.parse(
  1. PgByteDataReader reader
)

Implementation

@internal
DataRowMessage.parse(PgByteDataReader reader) {
  final fieldCount = reader.readInt16();

  for (var i = 0; i < fieldCount; i++) {
    final dataSize = reader.readInt32();

    if (dataSize == 0) {
      values.add(Uint8List(0));
    } else if (dataSize == -1) {
      values.add(null);
    } else if (dataSize < -1) {
      throw AssertionError('Bad data size for field $i: $dataSize');
    } else {
      final rawBytes = reader.read(dataSize);
      values.add(rawBytes);
    }
  }
}