/// <summary> /// This request is used to fetch the tables available in this database filtered by the provided criteria. /// </summary> public async Task <ResultSetResponse> TablesRequestAsync(string catalog, string schemaPattern, string tableNamePattern, pbc::RepeatedField <string> typeList, bool hasTypeList, string connectionId) { TablesRequest req = new TablesRequest { Catalog = catalog, SchemaPattern = schemaPattern, TableNamePattern = tableNamePattern, HasTypeList = hasTypeList, ConnectionId = connectionId }; req.TypeList.AddRange(typeList); WireMessage msg = new WireMessage { Name = Constants.WireMessagePrefix + "TablesRequest", WrappedMessage = req.ToByteString() }; using (Response webResponse = await PostRequestAsync(msg.ToByteArray())) { if (webResponse.WebResponse.StatusCode != HttpStatusCode.OK) { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ErrorResponse res = ErrorResponse.Parser.ParseFrom(output.WrappedMessage); throw new WebException( string.Format( "TablesRequestAsync failed! connectionId: {0}, Response code was: {1}, Response body was: {2}", connectionId, webResponse.WebResponse.StatusCode, res.ToString())); } else { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ResultSetResponse res = ResultSetResponse.Parser.ParseFrom(output.WrappedMessage); return(res); } } }
/// <summary> /// This request is used to fetch the tables available in this database filtered by the provided criteria. /// </summary> public async Task<ResultSetResponse> TablesRequestAsync(string catalog, string schemaPattern, string tableNamePattern, pbc::RepeatedField<string> typeList, bool hasTypeList, string connectionId, RequestOptions options) { TablesRequest req = new TablesRequest { Catalog = catalog, SchemaPattern = schemaPattern, TableNamePattern = tableNamePattern, TypeList = typeList, HasTypeList = hasTypeList, ConnectionId = connectionId }; WireMessage msg = new WireMessage { Name = Constants.WireMessagePrefix + "TablesRequest", WrappedMessage = req.ToByteString() }; using (Response webResponse = await PostRequestAsync(msg.ToByteArray(), options)) { if (webResponse.WebResponse.StatusCode != HttpStatusCode.OK) { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ErrorResponse res = ErrorResponse.Parser.ParseFrom(output.WrappedMessage); throw new WebException( string.Format( "TablesRequestAsync failed! connectionId: {0}, Response code was: {1}, Response body was: {2}", connectionId, webResponse.WebResponse.StatusCode, res.ToString())); } else { WireMessage output = WireMessage.Parser.ParseFrom(webResponse.WebResponse.GetResponseStream()); ResultSetResponse res = ResultSetResponse.Parser.ParseFrom(output.WrappedMessage); return res; } } }