示例#1
0
 public void Write(
     DrdaStreamWriter writer)
 {
     writer.WriteUInt8(0x00);
     writer.WriteUInt32((UInt32)_sqlStatement.Length);
     writer.WriteBytes(Encoding.UTF8.GetBytes(_sqlStatement));
     writer.WriteUInt8(0xFF);
 }
示例#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);
        }
示例#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);
        }
示例#4
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);
        }
示例#5
0
 public void Write(
     DrdaStreamWriter writer) =>
 writer.WriteBytes(_bytes);
示例#6
0
 public void Write(DrdaStreamWriter writer)
 {
     writer.WriteUInt16((UInt16)GetSize());
     writer.WriteUInt16((UInt16)CodePoint);
     writer.WriteBytes(Value);
 }
示例#7
0
 public void Write(DrdaStreamWriter writer)
 {
     writer.WriteUInt16((UInt16)GetSize());
     writer.WriteUInt16((UInt16)CodePoint);
     writer.WriteBytes(Reader?.ReadBytes(_totalByteLength));
 }