internal override DataRowMessage Load(ReadBuffer buf) { buf.Ensure(sizeof(short)); NumColumns = buf.ReadInt16(); Buffer = buf; Column = -1; ColumnLen = -1; PosInColumn = 0; return this; }
internal NpgsqlRawCopyStream(NpgsqlConnector connector, string copyCommand) { _connector = connector; _readBuf = connector.ReadBuffer; _writeBuf = connector.WriteBuffer; _connector.SendQuery(copyCommand); var msg = _connector.ReadMessage(DataRowLoadingMode.NonSequential); switch (msg.Code) { case BackendMessageCode.CopyInResponse: var copyInResponse = (CopyInResponseMessage) msg; IsBinary = copyInResponse.IsBinary; _canWrite = true; break; case BackendMessageCode.CopyOutResponse: var copyOutResponse = (CopyOutResponseMessage) msg; IsBinary = copyOutResponse.IsBinary; _canRead = true; break; default: throw _connector.UnexpectedMessageReceived(msg.Code); } }
public abstract void PrepareRead(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
internal NpgsqlNotificationEventArgs(ReadBuffer buf) { PID = buf.ReadInt32(); Condition = buf.ReadNullTerminatedString(); AdditionalInformation = buf.ReadNullTerminatedString(); }
TPsv ISimpleTypeHandler <TPsv> .Read(ReadBuffer buf, int len, [CanBeNull] FieldDescription fieldDescription) => ReadPsv(buf, len, fieldDescription);
internal override async ValueTask <object> ReadPsvAsObject(ReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null) => await Read <TPsv>(buf, len, async, fieldDescription);
internal virtual ValueTask <object> ReadPsvAsObject(ReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null) => ReadAsObject(buf, len, async, fieldDescription);
internal virtual object ReadPsvAsObjectFully(ReadBuffer buf, int len, FieldDescription fieldDescription = null) { return(ReadValueAsObjectFully(buf, len, fieldDescription)); }
internal abstract Task <T> ReadFullyAsync <T>(ReadBuffer buf, int len, CancellationToken cancellationToken, FieldDescription fieldDescription = null);
internal PostgresNotice(ReadBuffer buf) { _msg = new ErrorOrNoticeMessage(buf); }
void Cleanup() { _connector = null; _readBuf = null; _writeBuf = null; _isDisposed = true; }
internal void CopyTo(ReadBuffer other) { Contract.Assert(other.Size - other._filledBytes >= ReadBytesLeft); Array.Copy(_buf, ReadPosition, other._buf, other._filledBytes, ReadBytesLeft); other._filledBytes += ReadBytesLeft; }
internal ReadBuffer EnsureOrAllocateTemp(int count) { if (count <= Size) { Ensure(count); return this; } // Worst case: our buffer isn't big enough. For now, allocate a new buffer // and copy into it // TODO: Optimize with a pool later? var tempBuf = new ReadBuffer(Connector, Underlying, count, TextEncoding); CopyTo(tempBuf); Clear(); tempBuf.Ensure(count); return tempBuf; }
public void SetUp() { Underlying = new MemoryStream(); ReadBuffer = new ReadBuffer(null, Underlying, ReadBuffer.DefaultBufferSize, PGUtil.UTF8Encoding); }
public override void PrepareRead(ReadBuffer buf, int len, FieldDescription fieldDescription = null) { Contract.Requires(buf != null); }
internal abstract T ReadFully <T>(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
internal abstract object ReadValueAsObjectFully(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
internal PostgresException(ReadBuffer buf) { _msg = new ErrorOrNoticeMessage(buf); }
internal abstract ValueTask <object> ReadAsObject(ReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null);
public object ReadAsObject(ReadBuffer buf, int len, FieldDescription fieldDescription = null) { return(Read(buf, len, fieldDescription)); }
public abstract T Read(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
internal override object ReadPsvAsObjectFully(ReadBuffer buf, int len, FieldDescription fieldDescription = null) { return(ReadFully <TPsv>(buf, len, fieldDescription)); }
internal abstract TPsv ReadPsv(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
TPsv ISimpleTypeHandler <TPsv> .Read(ReadBuffer buf, int len, FieldDescription fieldDescription) { return(ReadPsv(buf, len, fieldDescription)); }
public abstract ValueTask <T> Read(ReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null);
internal void CopyTo(ReadBuffer other) { Debug.Assert(other.Size - other._filledBytes >= ReadBytesLeft); Array.Copy(Buffer, ReadPosition, other.Buffer, other._filledBytes, ReadBytesLeft); other._filledBytes += ReadBytesLeft; }