public override AstElement Clone(Dictionary<AstElement, AstElement> alreadyClonedElements) { TopClause result = new TopClause(); result.Value = _value; result.WithTies = _withTies; return result; }
public override AstElement Clone(Dictionary <AstElement, AstElement> alreadyClonedElements) { TopClause result = new TopClause(); result.Value = _value; result.WithTies = _withTies; return(result); }
private QueryNode ParseSelectQuery() { if (_token.Id == TokenId.LeftParentheses) { NextToken(); QueryNode result = ParseQuery(); Match(TokenId.RightParentheses); return result; } if (!Match(TokenId.SELECT)) return null; SelectQuery selectQuery = new SelectQuery(); // DISTINCT if (_token.Id == TokenId.DISTINCT) { selectQuery.IsDistinct = true; NextToken(); } // TOP if (_token.Id == TokenId.TOP) { NextToken(); TopClause topClause = new TopClause(); topClause.Value = (int)ParseInteger(); if (_token.Id == TokenId.WITH) { NextToken(); Match(TokenId.TIES); topClause.WithTies = true; } selectQuery.TopClause = topClause; } // SelectColumns selectQuery.SelectColumns = ParseColumnSources(); // FROM if (_token.Id == TokenId.FROM) { NextToken(); selectQuery.TableReferences = ParseTableReferences(); } // WHERE if (_token.Id == TokenId.WHERE) { NextToken(); selectQuery.WhereClause = ParseExpression(); } // GROUP BY if (_token.Id == TokenId.GROUP) { NextToken(); Match(TokenId.BY); selectQuery.GroupByColumns = ParseExpressions(); } // HAVING if (_token.Id == TokenId.HAVING) { NextToken(); selectQuery.HavingClause = ParseExpression(); } return selectQuery; }
private QueryNode ParseSelectQuery() { if (_token.Id == TokenId.LeftParentheses) { NextToken(); QueryNode result = ParseQuery(); Match(TokenId.RightParentheses); return(result); } if (!Match(TokenId.SELECT)) { return(null); } SelectQuery selectQuery = new SelectQuery(); // DISTINCT if (_token.Id == TokenId.DISTINCT) { selectQuery.IsDistinct = true; NextToken(); } // TOP if (_token.Id == TokenId.TOP) { NextToken(); TopClause topClause = new TopClause(); topClause.Value = (int)ParseInteger(); if (_token.Id == TokenId.WITH) { NextToken(); Match(TokenId.TIES); topClause.WithTies = true; } selectQuery.TopClause = topClause; } // SelectColumns selectQuery.SelectColumns = ParseColumnSources(); // FROM if (_token.Id == TokenId.FROM) { NextToken(); selectQuery.TableReferences = ParseTableReferences(); } // WHERE if (_token.Id == TokenId.WHERE) { NextToken(); selectQuery.WhereClause = ParseExpression(); } // GROUP BY if (_token.Id == TokenId.GROUP) { NextToken(); Match(TokenId.BY); selectQuery.GroupByColumns = ParseExpressions(); } // HAVING if (_token.Id == TokenId.HAVING) { NextToken(); selectQuery.HavingClause = ParseExpression(); } return(selectQuery); }