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); }
private Schema GetSchema(string sql, ServerCallContext context) { var schema = _koraliumTransportService.GetSchema(sql, new Shared.SqlParameters(), context.GetHttpContext()); return(GetSchema(schema)); }