示例#1
0
        public TableMetadataResponse GetTables(ServerCallContext context)
        {
            var tables      = _koraliumExecutor.GetTables();
            var httpContext = context.GetHttpContext();

            TableMetadataResponse tableMetadataResponse = new TableMetadataResponse();

            int tableId    = 0;
            var parameters = new SqlParameters();

            foreach (var table in tables)
            {
                var columns = _koraliumExecutor.GetSchema(table.SelectAllColumnsStatement(), parameters, httpContext);

                var tableMetadata = new TableMetadata()
                {
                    Name    = table.Name,
                    TableId = tableId++
                };

                int columnRef = 0;
                foreach (var column in columns)
                {
                    tableMetadata.Columns.Add(ToMetadata(ref columnRef, column));
                }
                tableMetadataResponse.Tables.Add(tableMetadata);
            }

            return(tableMetadataResponse);
        }
示例#2
0
        public override async Task ListFlights(FlightCriteria request, IAsyncStreamWriter <FlightInfo> responseStream, ServerCallContext context)
        {
            var tables = _koraliumTransportService.GetTables();

            var httpContext = context.GetHttpContext();

            foreach (var table in tables)
            {
                var selectAllSql = table.SelectAllColumnsStatement();
                await responseStream.WriteAsync(GetFlightInfo(selectAllSql, context));
            }
        }