applyToBuffer method

  1. @override
void applyToBuffer(
  1. PgByteDataWriter buffer
)
override

Implementation

@override
void applyToBuffer(PgByteDataWriter buffer) {
  buffer.writeUint8(ClientMessageId.parse);
  final statement = buffer.encodeString(_statement);
  final statementName = buffer.encodeString(_statementName);
  final length = 8 +
      statement.bytesLength +
      statementName.bytesLength +
      _typeOids.length * 4;
  buffer.writeUint32(length);
  // Name of prepared statement
  buffer.writeEncodedString(statementName);
  buffer.writeEncodedString(statement); // Query string

  // Parameters and their types
  buffer.writeUint16(_typeOids.length);
  for (final oid in _typeOids) {
    buffer.writeInt32(oid ?? 0);
  }
}