示例#1
0
        public override VfpExpression Visit(VfpVariableReferenceExpression expression)
        {
            Write(" ");
            Write(expression.VariableName);

            return(expression);
        }
        public override VfpExpression Visit(VfpVariableReferenceExpression expression)
        {
            foreach (var shortNames in SqlVisitor.AliasNames)
            {
                if (expression.VariableName.StartsWith(shortNames))
                {
                    return(new VfpVariableReferenceExpression(expression.ResultType, expression.VariableName.Replace(shortNames, shortNames.Substring(0, 1))));
                }
            }

            return(base.Visit(expression));
        }
示例#3
0
        private static VfpExpression GetScanProperty(VfpVariableReferenceExpression variable, VfpExpression property)
        {
            var expression   = VariableReferenceReplacer.Replace(variable, property);
            var scanProperty = expression as VfpPropertyExpression;

            if (scanProperty == null)
            {
                return(expression);
            }

            var variables = VariableReferenceGatherer.Gather(expression);

            if (!variables.Any())
            {
                return(expression);
            }

            var scanVariable = variables.First();

            return(scanVariable.Property(scanProperty.ResultType, scanProperty.Property));
        }
        private VfpLimitExpression GetVfpLimitExpression(VfpLimitExpression limitExpression, VfpScanExpression scanExpression)
        {
            if (scanExpression == null)
            {
                return(null);
            }

            var keyMembers = GetKeyMembers(scanExpression.Target.ElementType.KeyMembers);

            if (!keyMembers.Any())
            {
                return(null);
            }

            var variableReference = new VfpVariableReferenceExpression(scanExpression.ResultType, GetUniqueVariableName());
            var expressionBinding = new VfpExpressionBinding(scanExpression, variableReference);
            var sortClauses       = GetSortClauses(keyMembers, expressionBinding).ToList().AsReadOnly();
            var sortExpression    = new VfpSortExpression(scanExpression.ResultType, expressionBinding, sortClauses);

            return(new VfpLimitExpression(limitExpression.ResultType,
                                          sortExpression,
                                          limitExpression.Limit,
                                          limitExpression.WithTies));
        }
示例#5
0
        public static VfpExpression Replace(VfpVariableReferenceExpression variableReferenceExpression, VfpExpression expression)
        {
            var rewriter = new VariableReferenceReplacer(variableReferenceExpression);

            return(rewriter.Visit(expression));
        }
示例#6
0
 public override VfpExpression Visit(VfpVariableReferenceExpression expression)
 {
     return(_variableReferenceExpression);
 }
示例#7
0
 public VariableReferenceReplacer(VfpVariableReferenceExpression variableReferenceExpression)
 {
     _variableReferenceExpression = variableReferenceExpression;
 }
示例#8
0
 public override VfpExpression Visit(VfpVariableReferenceExpression expression)
 {
     return(new VfpVariableReferenceExpression(_variableReference.ResultType, _variableReference.VariableName));
 }
示例#9
0
 public VfpVariableReferenceExpressionRewriter(VfpVariableReferenceExpression variableReference)
 {
     _variableReference = variableReference;
 }
 protected VfpVariableReferenceExpression VisitNullHandler(VfpVariableReferenceExpression expression)
 {
     return(expression);
 }
 public virtual VfpExpression Visit(VfpVariableReferenceExpression expression)
 {
     return(new VfpVariableReferenceExpression(expression.ResultType, expression.VariableName));
 }
示例#12
0
        public override VfpExpression Visit(VfpVariableReferenceExpression expression)
        {
            _expressions.Add(expression);

            return(base.Visit(expression));
        }