public override IASTNode VisitSelectClause(SqlServerCommandParser.SelectClauseContext context) { var result = new SelectCommand(); result.Projections = (ProjectionsSegment)Visit(context.projections()); if (null != context.duplicateSpecification()) { result.Projections.SetDistinctRow(IsDistinct(context)); } if (null != context.fromClause()) { CollectionValue <TableReferenceSegment> tableReferences = (CollectionValue <TableReferenceSegment>)Visit(context.fromClause()); foreach (var tableReferenceSegment in tableReferences.GetValue()) { result.TableReferences.Add(tableReferenceSegment); } } if (null != context.whereClause()) { result.Where = (WhereSegment)Visit(context.whereClause()); } if (null != context.groupByClause()) { result.GroupBy = (GroupBySegment)Visit(context.groupByClause()); } if (null != context.orderByClause()) { result.OrderBy = (OrderBySegment)Visit(context.orderByClause()); } return(result); }
private bool IsDistinct(SqlServerCommandParser.SelectClauseContext context) { return(((BooleanLiteralValue)Visit(context.duplicateSpecification())).GetValue()); }