internal override DataRowMessage Load(ReadBuffer buf)
 {
     buf.Ensure(sizeof(short));
     NumColumns = buf.ReadInt16();
     Buffer = buf;
     Column = -1;
     ColumnLen = -1;
     PosInColumn = 0;
     return this;
 }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
 public abstract void PrepareRead(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
Ejemplo n.º 4
0
 internal NpgsqlNotificationEventArgs(ReadBuffer buf)
 {
     PID                   = buf.ReadInt32();
     Condition             = buf.ReadNullTerminatedString();
     AdditionalInformation = buf.ReadNullTerminatedString();
 }
Ejemplo n.º 5
0
 TPsv ISimpleTypeHandler <TPsv> .Read(ReadBuffer buf, int len, [CanBeNull] FieldDescription fieldDescription)
 => ReadPsv(buf, len, fieldDescription);
Ejemplo n.º 6
0
 internal override async ValueTask <object> ReadPsvAsObject(ReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null)
 => await Read <TPsv>(buf, len, async, fieldDescription);
Ejemplo n.º 7
0
 internal virtual ValueTask <object> ReadPsvAsObject(ReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null)
 => ReadAsObject(buf, len, async, fieldDescription);
Ejemplo n.º 8
0
 internal virtual object ReadPsvAsObjectFully(ReadBuffer buf, int len, FieldDescription fieldDescription = null)
 {
     return(ReadValueAsObjectFully(buf, len, fieldDescription));
 }
Ejemplo n.º 9
0
 internal abstract Task <T> ReadFullyAsync <T>(ReadBuffer buf, int len, CancellationToken cancellationToken, FieldDescription fieldDescription = null);
Ejemplo n.º 10
0
 internal PostgresNotice(ReadBuffer buf)
 {
     _msg = new ErrorOrNoticeMessage(buf);
 }
Ejemplo n.º 11
0
 void Cleanup()
 {
     _connector = null;
     _readBuf = null;
     _writeBuf = null;
     _isDisposed = true;
 }
Ejemplo n.º 12
0
 internal void CopyTo(ReadBuffer other)
 {
     Contract.Assert(other.Size - other._filledBytes >= ReadBytesLeft);
     Array.Copy(_buf, ReadPosition, other._buf, other._filledBytes, ReadBytesLeft);
     other._filledBytes += ReadBytesLeft;
 }
Ejemplo n.º 13
0
        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;
        }
Ejemplo n.º 14
0
 public void SetUp()
 {
     Underlying = new MemoryStream();
     ReadBuffer = new ReadBuffer(null, Underlying, ReadBuffer.DefaultBufferSize, PGUtil.UTF8Encoding);
 }
 internal NpgsqlNotificationEventArgs(ReadBuffer buf)
 {
     PID = buf.ReadInt32();
     Condition = buf.ReadNullTerminatedString();
     AdditionalInformation = buf.ReadNullTerminatedString();
 }
Ejemplo n.º 16
0
 public override void PrepareRead(ReadBuffer buf, int len, FieldDescription fieldDescription = null)
 {
     Contract.Requires(buf != null);
 }
Ejemplo n.º 17
0
 internal abstract T ReadFully <T>(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
Ejemplo n.º 18
0
 internal void CopyTo(ReadBuffer other)
 {
     Contract.Assert(other.Size - other._filledBytes >= ReadBytesLeft);
     Array.Copy(_buf, ReadPosition, other._buf, other._filledBytes, ReadBytesLeft);
     other._filledBytes += ReadBytesLeft;
 }
Ejemplo n.º 19
0
 internal abstract object ReadValueAsObjectFully(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
Ejemplo n.º 20
0
 internal PostgresException(ReadBuffer buf)
 {
     _msg = new ErrorOrNoticeMessage(buf);
 }
Ejemplo n.º 21
0
 internal abstract ValueTask <object> ReadAsObject(ReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null);
Ejemplo n.º 22
0
 public object ReadAsObject(ReadBuffer buf, int len, FieldDescription fieldDescription = null)
 {
     return(Read(buf, len, fieldDescription));
 }
Ejemplo n.º 23
0
 public abstract T Read(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
Ejemplo n.º 24
0
 internal override object ReadPsvAsObjectFully(ReadBuffer buf, int len, FieldDescription fieldDescription = null)
 {
     return(ReadFully <TPsv>(buf, len, fieldDescription));
 }
Ejemplo n.º 25
0
 internal abstract TPsv ReadPsv(ReadBuffer buf, int len, FieldDescription fieldDescription = null);
Ejemplo n.º 26
0
 TPsv ISimpleTypeHandler <TPsv> .Read(ReadBuffer buf, int len, FieldDescription fieldDescription)
 {
     return(ReadPsv(buf, len, fieldDescription));
 }
Ejemplo n.º 27
0
 public abstract ValueTask <T> Read(ReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null);
Ejemplo n.º 28
0
 internal void CopyTo(ReadBuffer other)
 {
     Debug.Assert(other.Size - other._filledBytes >= ReadBytesLeft);
     Array.Copy(Buffer, ReadPosition, other.Buffer, other._filledBytes, ReadBytesLeft);
     other._filledBytes += ReadBytesLeft;
 }