public override void Perform(Identifier node) { if (node == null) { throw new ArgumentNullException("node"); } base.Perform(node); if (TailorUtil.IsRownum(node)) { int limit = 0; QueryExpression query = GetAncestor <QueryExpression>(null, null); if (query != null) { Expression relational = GetExpressionAncestor(null, query); if (relational != null) { limit = TailorUtil.GetRownumExpressionLimit(relational); if (limit > 0) { bool matched = false; Expression logical = GetExpressionAncestor(relational, query); if (logical == null) { if (query.Where == relational) { query.Where = null; matched = true; } } else { if (logical.Operator == ExpressionOperator.And) { if (relational == logical.Left) { logical.Operator = null; logical.Left = null; matched = true; } else if (relational == logical.Right) { logical.Operator = null; logical.Right = null; matched = true; } } } if (matched) { SetTop(query, limit); } else { limit = -1; } } } } if (limit <= 0) { throw new InvalidOperationException( "MS engines do not have ROWNUM."); } } }