Exemple #1
0
        public override byte[] Serialize()
        {
            var buffer = new PostgresProtocolStream();

            buffer.Write(PortalName);
            buffer.Write(Limit);

            return(buffer.ToArray());
        }
Exemple #2
0
        public override byte[] Serialize()
        {
            var buffer = new PostgresProtocolStream();

            buffer.Write(Length);
            buffer.Write(CancelRequestCode);
            buffer.Write(ProcessId);
            buffer.Write(SecretKey);

            return(buffer.ToArray());
        }
Exemple #3
0
            public override byte[] Serialize()
            {
                var buffer = new PostgresProtocolStream();

                buffer.Write(PropertyString);

                return(buffer.ToArray());
            }
        public override byte[] Serialize()
        {
            var buffer = new PostgresProtocolStream();

            buffer.WriteByte(TargetType);
            buffer.Write(TargetName);

            return(buffer.ToArray());
        }
Exemple #5
0
        public void Write_Int16_ToPostgresProtocolBytes()
        {
            // arrange
            var stream = new PostgresProtocolStream();

            stream.Write((short)(39 * 256 + 16)); // 10000
            stream.Position = 0;

            // act
            var result = new byte[sizeof(short)];

            stream.Read(result, 0, sizeof(short));

            // assert
            var expected = new byte[] { 39, 16 };

            Assert.Equal(expected, result);
        }
Exemple #6
0
        public void Write_String_ToPostgresProtocolBytes()
        {
            // arrange
            var stream = new PostgresProtocolStream();

            stream.Write("test");
            stream.Position = 0;

            // act
            var result = new byte[5];

            stream.Read(result, 0, 5);

            // assert
            var expect = new byte[] { (byte)'t', (byte)'e', (byte)'s', (byte)'t', 0 };

            Assert.Equal(expect, result);
        }