public static async ValueTask <ServerErrorMessage> Read(ClickHouseBinaryProtocolReader reader, bool async, CancellationToken cancellationToken) { var errorCode = await reader.ReadInt32(async, cancellationToken); var name = await reader.ReadString(async, cancellationToken); var errorMessage = await reader.ReadString(async, cancellationToken); var stackTrace = await reader.ReadString(async, cancellationToken); bool hasNested = await reader.ReadBool(async, cancellationToken); ClickHouseServerException exception; if (hasNested) { var nested = await Read(reader, async, cancellationToken); exception = new ClickHouseServerException(errorCode, name, errorMessage, stackTrace, nested.Exception); } else { exception = new ClickHouseServerException(errorCode, name, errorMessage, stackTrace); } return(new ServerErrorMessage(exception)); }
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 <ServerTableColumnsMessage> Read(ClickHouseBinaryProtocolReader reader, bool async, CancellationToken cancellationToken) { await reader.ReadString(async, cancellationToken); var columns = await reader.ReadString(async, cancellationToken); return(new ServerTableColumnsMessage(columns)); }
public static async ValueTask <ServerDataMessage> Read(ClickHouseBinaryProtocolReader reader, ServerMessageCode messageCode, bool async, CancellationToken cancellationToken) { string?tempTableName = await reader.ReadString(async, cancellationToken); if (tempTableName == string.Empty) { tempTableName = null; } return(new ServerDataMessage(messageCode, tempTableName)); }