public static QsiDataDeleteActionNode VisitDeleteStatement(DeleteStatementContext context) { var partitionRestriction = context.partitionRestriction(); var whereClause = context.whereClause(); var hintClause = context.hintClause(); QsiTableNode tableNode = new HanaTableReferenceNode { Identifier = context.tableName().qqi }; if (partitionRestriction != null) { ((HanaTableReferenceNode)tableNode).Partition.Value = TreeHelper.Fragment(partitionRestriction.GetInputText()); } if (whereClause != null || hintClause != null) { var derivedTableNode = new HanaDerivedTableNode { Columns = { Value = TreeHelper.CreateAllColumnsDeclaration() }, Source = { Value = tableNode } }; if (whereClause != null) { derivedTableNode.Where.Value = ExpressionVisitor.VisitWhereClause(whereClause); } if (hintClause != null) { derivedTableNode.Hint.Value = TreeHelper.Fragment(hintClause.GetInputText()); } tableNode = derivedTableNode; } var node = new QsiDataDeleteActionNode { Target = { Value = tableNode } }; HanaTree.PutContextSpan(node, context); return(node); }
public static QsiTableNode VisitSelectStatement(SelectStatementContext context) { var withClause = context.withClause(); var subquery = context.subquery(); var forClause = context.forClause(); var timeTravel = context.timeTravel(); var hintClause = context.hintClause(); var subqueryNode = VisitSubquery(subquery); if (withClause is null && forClause is null && timeTravel is null && hintClause is null) { return(subqueryNode); } if (subqueryNode is not HanaDerivedTableNode derivedTableNode) { derivedTableNode = new HanaDerivedTableNode { Columns = { Value = TreeHelper.CreateAllColumnsDeclaration() }, Source = { Value = subqueryNode } }; } if (withClause is not null) { derivedTableNode.Directives.SetValue(VisitWithClause(withClause)); } if (forClause is not null) { derivedTableNode.Behavior.SetValue(VisitForClause(forClause)); } if (timeTravel is not null) { derivedTableNode.TimeTravel.SetValue(TreeHelper.Fragment(timeTravel.GetInputText())); } if (hintClause is not null) { derivedTableNode.Hint.SetValue(TreeHelper.Fragment(hintClause.GetInputText())); } return(derivedTableNode); }