Exemplo n.º 1
0
        public CompletedResponse(Stream stream, ByteBuffer buffer)
        {
            int bRead;

            buffer.Reset();
            for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte())
            {
                buffer.Add((byte)bRead);
            }
            if (bRead == ' ' && buffer.GetPosition() == INSERT.Length && buffer.AreSame(INSERT))
            {
                long lioid = 0;
                for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte())
                {
                    lioid = (lioid << 3) + (lioid << 1) + bRead - 48;
                }
                if (bRead == ' ')
                {
                    LastInsertedOID = lioid;
                }
            }
            while (bRead > 0)
            {
                buffer.Reset();
                for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte())
                {
                    buffer.Add((byte)bRead);
                }
            }
            if (bRead == -1)
            {
                throw new IOException();
            }
            RowsAffected = buffer.TryGetInt();
        }
Exemplo n.º 2
0
 public CompletedResponse(Stream stream, ByteBuffer buffer)
 {
     int bRead;
     buffer.Reset();
     for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte())
         buffer.Add((byte)bRead);
     if (bRead == ' ' && buffer.GetPosition() == INSERT.Length && buffer.AreSame(INSERT))
     {
         long lioid = 0;
         for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte())
             lioid = (lioid << 3) + (lioid << 1) + bRead - 48;
         if (bRead == ' ') LastInsertedOID = lioid;
     }
     while (bRead > 0)
     {
         buffer.Reset();
         for (bRead = stream.ReadByte(); bRead > 0 && bRead != ' '; bRead = stream.ReadByte())
             buffer.Add((byte)bRead);
     }
     if (bRead == -1)
     {
         throw new IOException();
     }
     RowsAffected = buffer.TryGetInt();
 }
Exemplo n.º 3
0
        ///<summary>
        /// This method gets a C NULL terminated string from the network stream.
        /// It keeps reading a byte in each time until a NULL byte is returned.
        /// It returns the resultant string of bytes read.
        /// This string is sent from backend.
        /// </summary>
        public static String ReadString(Stream network_stream, ByteBuffer buffer)
        {
            buffer.Reset();
            int bRead;

            for (bRead = network_stream.ReadByte(); bRead > 0; bRead = network_stream.ReadByte())
            {
                buffer.Add((byte)bRead);
            }
            if (bRead == -1)
            {
                throw new IOException();
            }
            return(buffer.GetUtf8String());
        }