Exemplo n.º 1
0
 public void Write(
     DrdaStreamWriter writer)
 {
     writer.WriteUInt8(0x00);
     writer.WriteUInt32((UInt32)_sqlStatement.Length);
     writer.WriteBytes(Encoding.UTF8.GetBytes(_sqlStatement));
     writer.WriteUInt8(0xFF);
 }
Exemplo n.º 2
0
        public static void WriteVarString(
            this DrdaStreamWriter writer,
            String value)
        {
            var bytes = Encoding.UTF8.GetBytes(value);

            writer.WriteUInt16((UInt16)bytes.Length);
            writer.WriteBytes(bytes);
        }
Exemplo n.º 3
0
        public static void WriteString(
            this DrdaStreamWriter writer,
            String value,
            Int32 maxLength)
        {
            value = value?.Substring(0, maxLength) ?? String.Empty;
            var bytes = Encoding.UTF8.GetBytes(value);

            writer.WriteBytes(bytes);
        }
Exemplo n.º 4
0
            public void Write(DrdaStreamWriter writer)
            {
                writer.WriteUInt16((UInt16)GetSize());
                writer.WriteUInt16((UInt16)CodePoint.MGRLVLLS);

                foreach (var value in Values)
                {
                    writer.WriteUInt16(value);
                }
            }
Exemplo n.º 5
0
        public void Write(
            DrdaStreamWriter writer)
        {
            writer.WriteUInt16((UInt16)GetSize());
            writer.WriteUInt8(0xD0); // DDMID
            writer.WriteUInt8((Byte)_format);
            writer.WriteUInt16(_requestCorrelationId);

            _command.Write(writer);
        }
Exemplo n.º 6
0
        public void Write(
            DrdaStreamWriter writer)
        {
            var size = GetSize();

            if (size > MaxSize)
            {
                writer.WriteUInt16(SegmentFlag);
                writer.WriteUInt16((UInt16)CodePoint);
                writer.WriteUInt32(size);
            }
            else
            {
                writer.WriteUInt16((UInt16)size);
                writer.WriteUInt16((UInt16)CodePoint);
            }

            foreach (var parameter in _parameters)
            {
                parameter.Write(writer);
            }
        }
Exemplo n.º 7
0
        public static void WriteDecimal(
            this DrdaStreamWriter writer,
            Decimal value,
            Int32 precision,
            Int32 scale)
        {
            var bytes = new Byte[precision / 2 + 1];

            value *= Scales[scale];

            var nybble = value < 0 ? 0x0d : 0x0c;

            value = Decimal.Floor(Decimal.Negate(value));

            var i = bytes.Length - 1;

            if (precision % 2 == 1)
            {
                nybble |= (Int32)(value % 10) << 4;
                value  /= 10;
            }
            bytes[i] = (Byte)(nybble & 0xFF);

            for (--i; i >= 0; --i)
            {
                nybble = (Int32)(value % 10);
                value /= 10;

                nybble |= (Int32)(value % 10) << 4;
                value  /= 10;

                bytes[i] = (Byte)(nybble & 0xFF);
            }

            writer.WriteBytes(bytes);
        }
Exemplo n.º 8
0
 public void Write(DrdaStreamWriter writer)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
 public void Write(DrdaStreamWriter writer)
 {
     writer.WriteUInt16((UInt16)GetSize());
     writer.WriteUInt16((UInt16)CodePoint);
     writer.WriteUInt16(Value);
 }
Exemplo n.º 10
0
 public void Write(
     DrdaStreamWriter writer)
 {
     writer.WriteUInt8((Byte)_type);
     writer.WriteUInt16(_length);
 }
Exemplo n.º 11
0
 public void Write(
     DrdaStreamWriter writer) =>
 writer.WriteBytes(_bytes);
Exemplo n.º 12
0
 public void Write(DrdaStreamWriter writer)
 {
     writer.WriteUInt16((UInt16)GetSize());
     writer.WriteUInt16((UInt16)CodePoint);
     writer.WriteBytes(Reader?.ReadBytes(_totalByteLength));
 }