示例#1
0
        public static async Task <ServerHelloMessage> Read(ClickHouseBinaryProtocolReader reader, bool async, CancellationToken cancellationToken)
        {
            var serverName = await reader.ReadString(async, cancellationToken);

            var mj = await reader.Read7BitInt32(async, cancellationToken);

            var mr = await reader.Read7BitInt32(async, cancellationToken);

            var rv = await reader.Read7BitInt32(async, cancellationToken);

            if (rv < ClickHouseProtocolRevisions.MinSupportedRevision)
            {
                throw new ClickHouseException(
                          ClickHouseErrorCodes.ProtocolRevisionNotSupported,
                          $"The revision {rv} of ClickHouse server is not supported. Minimal supported revision is {ClickHouseProtocolRevisions.MinSupportedRevision}.");
            }

            var tz = await reader.ReadString(async, cancellationToken);

            var displayName = await reader.ReadString(async, cancellationToken);

            var b = await reader.ReadByte(async, cancellationToken);

            var serverVersion = new ClickHouseVersion(mj, mr, b);

            var serverInfo = new ClickHouseServerInfo(serverName, serverVersion, rv, tz, displayName);

            return(new ServerHelloMessage(serverInfo));
        }
        public static async ValueTask <ServerProgressMessage> Read(ClickHouseBinaryProtocolReader reader, bool async, CancellationToken cancellationToken)
        {
            int rows = await reader.Read7BitInt32(async, cancellationToken);

            int bytes = await reader.Read7BitInt32(async, cancellationToken);

            int totals = await reader.Read7BitInt32(async, cancellationToken);

            int writtenRows = await reader.Read7BitInt32(async, cancellationToken);

            int writtenBytes = await reader.Read7BitInt32(async, cancellationToken);

            return(new ServerProgressMessage(rows, bytes, totals, writtenRows, writtenBytes));
        }
示例#3
0
        public static async ValueTask <ServerProfileInfoMessage> Read(ClickHouseBinaryProtocolReader reader, bool async, CancellationToken cancellationToken)
        {
            int rows = await reader.Read7BitInt32(async, cancellationToken);

            int blocks = await reader.Read7BitInt32(async, cancellationToken);

            int bytes = await reader.Read7BitInt32(async, cancellationToken);

            bool limitApplied = await reader.ReadBool(async, cancellationToken);

            int rowsBeforeLimit = await reader.Read7BitInt32(async, cancellationToken);

            int calculatedRowsBeforeLimit = await reader.Read7BitInt32(async, cancellationToken);

            return(new ServerProfileInfoMessage(rows, blocks, bytes, limitApplied, rowsBeforeLimit, calculatedRowsBeforeLimit));
        }