public WDeleteNodeSpecification(WDeleteSpecification deleteSpec) { FirstTokenIndex = deleteSpec.FirstTokenIndex; LastTokenIndex = deleteSpec.LastTokenIndex; TopRowFilter = deleteSpec.TopRowFilter; Target = deleteSpec.Target; WhereClause = deleteSpec.WhereClause; }
private WSqlStatement ConvertSqlDeleteStatement(WDeleteSpecification sqlDeleteStatement) { if (_nodeCount >= _annotations.Count || sqlDeleteStatement.LastTokenIndex < _annotations[_nodeCount].Position) { return(sqlDeleteStatement); } if (_annotations[_nodeCount] is DeleteNodeAnnotation) { _nodeCount++; return(new WDeleteNodeSpecification(sqlDeleteStatement)); } else { throw new GraphViewException("Cannot assign modification annotations back."); } }
private WSqlStatement ParseDeleteStatement(DeleteSpecification delSpec) { if (delSpec == null) return null; var wdelSpec = new WDeleteSpecification { Target = ParseTableReference(delSpec.Target), FirstTokenIndex = delSpec.FirstTokenIndex, LastTokenIndex = delSpec.LastTokenIndex }; //From Clause if (delSpec.FromClause != null && delSpec.FromClause.TableReferences != null) { wdelSpec.FromClause = new WFromClause { FirstTokenIndex = delSpec.FromClause.FirstTokenIndex, LastTokenIndex = delSpec.FromClause.LastTokenIndex, TableReferences = new List<WTableReference>(delSpec.FromClause.TableReferences.Count) }; foreach (var pref in delSpec.FromClause.TableReferences.Select(ParseTableReference).Where(pref => pref != null)) { wdelSpec.FromClause.TableReferences.Add(pref); } } //where clause if (delSpec.WhereClause != null && delSpec.WhereClause.SearchCondition != null) { wdelSpec.WhereClause = new WWhereClause { FirstTokenIndex = delSpec.WhereClause.FirstTokenIndex, LastTokenIndex = delSpec.WhereClause.LastTokenIndex, SearchCondition = ParseBooleanExpression(delSpec.WhereClause.SearchCondition) }; } //top row filter if (delSpec.TopRowFilter != null) { wdelSpec.TopRowFilter = new WTopRowFilter { Expression = ParseScalarExpression(delSpec.TopRowFilter.Expression), Percent = delSpec.TopRowFilter.Percent, WithTies = delSpec.TopRowFilter.WithTies, FirstTokenIndex = delSpec.TopRowFilter.FirstTokenIndex, LastTokenIndex = delSpec.TopRowFilter.LastTokenIndex }; } return wdelSpec; }
public virtual void Visit(WDeleteSpecification node) { node.AcceptChildren(this); }
private WSqlStatement ConvertSqlDeleteStatement(WDeleteSpecification sqlDeleteStatement) { if (_nodeCount >= _annotations.Count || sqlDeleteStatement.LastTokenIndex < _annotations[_nodeCount].Position) { return sqlDeleteStatement; } if (_annotations[_nodeCount] is DeleteNodeAnnotation) { _nodeCount++; return new WDeleteNodeSpecification(sqlDeleteStatement); } else { throw new GraphViewException("Cannot assign modification annotations back."); } }