Пример #1
0
        internal static HashSet <SqlAlias> Gather(SqlNode node)
        {
            ConsumedAliaseGatherer g = new ConsumedAliaseGatherer();

            g.Visit(node);
            return(g.Consumed);
        }
        /// <summary>
        /// Gets the annotations for the given node. Null if none.
        /// </summary>
        internal List <SqlNodeAnnotation> Get(SqlNode node)
        {
            List <SqlNodeAnnotation> list = null;

            this.annotationMap.TryGetValue(node, out list);
            return(list);
        }
Пример #3
0
        internal static SqlNode Lift(SqlNode node)
        {
            ColumnLifter cl = new ColumnLifter();

            node = cl.Visit(node);
            return(node);
        }
Пример #4
0
        private SqlNode ParseDelete()
        {
            if (tokenizer.IsEof)
            {
                throw ReportError("Unexpected EOF");
            }

            var token = tokenizer.Peek();

            if (!token.IsKeyword("FROM"))
            {
                throw ReportError("Expecting FROM keyword. Got " + token.ToString());
            }

            tokenizer.Next();
            SqlNode nameToRemove = ParseIdendifier();

            SqlNode condition = null;

            if (IsKeyword("WHERE"))
            {
                tokenizer.Next();
                condition = ParseExpression();
            }

            SkipPunctuation(";");
            return(new DeleteNode(nameToRemove, condition));
        }
Пример #5
0
        private void GatherUnionExpressions(SqlNode node, List <SqlExpression> exprs)
        {
            SqlUnion union = node as SqlUnion;

            if (union != null)
            {
                this.GatherUnionExpressions(union.Left, exprs);
                this.GatherUnionExpressions(union.Right, exprs);
            }
            else
            {
                SqlSelect sel = node as SqlSelect;
                if (sel != null)
                {
                    SqlAliasRef aref = sel.Selection as SqlAliasRef;
                    if (aref != null)
                    {
                        this.GatherUnionExpressions(aref.Alias.Node, exprs);
                    }
                    else
                    {
                        exprs.Add(sel.Selection);
                    }
                }
            }
        }
Пример #6
0
        internal override SqlExpression VisitAliasRef(SqlAliasRef aref)
        {
            SqlNode node = aref.Alias.Node;

            if (node is SqlTable || node is SqlTableValuedFunctionCall)
            {
                return(aref);
            }
            SqlUnion union = node as SqlUnion;

            if (union != null)
            {
                return(this.ExpandUnion(union));
            }
            SqlSelect ss = node as SqlSelect;

            if (ss != null)
            {
                return(this.VisitExpression(ss.Selection));
            }
            SqlExpression exp = node as SqlExpression;

            if (exp != null)
            {
                return(this.VisitExpression(exp));
            }
            throw Error.CouldNotHandleAliasRef(node.NodeType);
        }
        internal static HashSet <SqlAlias> Gather(SqlNode node)
        {
            ProducedAliasGatherer g = new ProducedAliasGatherer();

            g.Visit(node);
            return(g.Produced);
        }
Пример #8
0
        public TreeNode[] GetSubObjectHierarchy(TreeNode node)
        {
            mk.Logic.simpleDebug.dump();
            // Show the column breakdown for the selected table
            // return null;
            if (node is SqlNode)
            {
                SqlNode on = (SqlNode)node;
                if (on.type == "T" || on.type == "V")
                {
                    DataSet ds = dbClient.Execute("PRAGMA table_info(" + on.Text + ");", timeout);
                    if (ds == null || ds.Tables.Count == 0)
                    {
                        return(null);
                    }

                    TreeNode[] tn    = new SqlNode[ds.Tables[0].Rows.Count];
                    int        count = 0;

                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        string nullable = row["notnull"].ToString().StartsWith("0") ? "" : "not null";

                        SqlNode column = new SqlNode(row["name"].ToString() + " ("
                                                     + row["type"].ToString() + ", " + nullable + ")");

                        column.dragText = row["name"].ToString();

                        tn[count++] = column;
                    }
                    return(tn);
                }
            }
            return(null);
        }
Пример #9
0
        private static ProviderType GetSqlType(SqlNode node)
        {
            var exp = node as SqlExpression;

            if (exp != null)
            {
                return(exp.SqlType);
            }
            var sel = node as SqlSelect;

            if (sel != null)
            {
                return(sel.Selection.SqlType);
            }
            var tab = node as SqlTable;

            if (tab != null)
            {
                return(tab.SqlRowType);
            }
            var su = node as SqlUnion;

            if (su != null)
            {
                return(su.GetSqlType());
            }
            throw Error.UnexpectedNode(node.NodeType);
        }
Пример #10
0
            internal virtual void VisitWithParens(SqlNode node, SqlNode outer) {
                if (node == null)
                    return;
                switch (node.NodeType) {
                    case SqlNodeType.ColumnRef:
                    case SqlNodeType.Value:
                    case SqlNodeType.Member:
                    case SqlNodeType.Parameter:
                    case SqlNodeType.FunctionCall:
                    case SqlNodeType.TableValuedFunctionCall:
                    case SqlNodeType.OuterJoinedValue:
                        this.Visit(node);
                        break;
                    case SqlNodeType.Add:
                    case SqlNodeType.Mul:
                    case SqlNodeType.And:
                    case SqlNodeType.Or:
                    case SqlNodeType.Not:
                    case SqlNodeType.Not2V:
                    case SqlNodeType.BitAnd:
                    case SqlNodeType.BitOr:
                    case SqlNodeType.BitXor:
                    case SqlNodeType.BitNot:
                        if (outer.NodeType != node.NodeType)
                            goto default;
                        this.Visit(node);
                        break;

                    default:
                        this.sb.Append("(");
                        this.Visit(node);
                        this.sb.Append(")");
                        break;
                }
            }
Пример #11
0
 // Methods
 internal override SqlNode Visit(SqlNode node)
 {
     if (node == null)
     {
         return(null);
     }
     if (this.isSimple)
     {
         switch (node.NodeType)
         {
         case SqlNodeType.Add:
         case SqlNodeType.And:
         case SqlNodeType.Between:
         case SqlNodeType.BitAnd:
         case SqlNodeType.BitNot:
         case SqlNodeType.BitOr:
         case SqlNodeType.BitXor:
         case SqlNodeType.Cast:
         case SqlNodeType.ClrLength:
         case SqlNodeType.ColumnRef:
         case SqlNodeType.Concat:
         case SqlNodeType.Convert:
         case SqlNodeType.Div:
         case SqlNodeType.ExprSet:
         case SqlNodeType.EQ:
         case SqlNodeType.EQ2V:
         case SqlNodeType.FunctionCall:
         case SqlNodeType.IsNotNull:
         case SqlNodeType.IsNull:
         case SqlNodeType.LE:
         case SqlNodeType.Like:
         case SqlNodeType.LT:
         case SqlNodeType.GE:
         case SqlNodeType.GT:
         case SqlNodeType.Member:
         case SqlNodeType.Mod:
         case SqlNodeType.Mul:
         case SqlNodeType.NE:
         case SqlNodeType.NE2V:
         case SqlNodeType.Negate:
         case SqlNodeType.Not:
         case SqlNodeType.Not2V:
         case SqlNodeType.Or:
         case SqlNodeType.OptionalValue:
         case SqlNodeType.OuterJoinedValue:
         case SqlNodeType.Parameter:
         case SqlNodeType.SearchedCase:
         case SqlNodeType.SimpleCase:
         case SqlNodeType.Sub:
         case SqlNodeType.Treat:
         case SqlNodeType.TypeCase:
         case SqlNodeType.Variable:
         case SqlNodeType.Value:
         case SqlNodeType.ValueOf:
             return(base.Visit(node));
         }
         this.isSimple = false;
     }
     return(node);
 }
Пример #12
0
        private List <SqlParameterInfo> ParameterizeInternal(SqlNode node)
        {
            SqlParameterInfoProducer v = new SqlParameterInfoProducer(this);

            v.Visit(node);
            return(new List <SqlParameterInfo>(v.CurrentParams));
        }
Пример #13
0
 internal SqlColumn BubbleUp(SqlColumn col, SqlNode source)
 {
     this.match = this.GetOriginatingColumn(col);
     this.found = null;
     this.Visit(source);
     return(this.found);
 }
Пример #14
0
 /// <summary>
 /// Execute each current validator.
 /// </summary>
 internal void Validate(SqlNode node)
 {
     foreach (SqlVisitor validator in this.validators)
     {
         validator.Visit(node);
     }
 }
Пример #15
0
        private List <SqlParameterInfo> ParameterizeInternal(SqlNode node)
        {
            var visitor = new Visitor(this);

            visitor.Visit(node);
            return(new List <SqlParameterInfo>(visitor.currentParams));
        }
Пример #16
0
        internal static HashSet <SqlColumn> Gather(SqlNode node, HashSet <SqlColumn> columns)
        {
            Visitor v = new Visitor(columns);

            v.Visit(node);
            return(columns);
        }
Пример #17
0
        internal static bool IsDependent(SqlNode node, HashSet <SqlAlias> aliasesToCheck, HashSet <SqlExpression> ignoreExpressions)
        {
            AliasDependencyChecker v = new AliasDependencyChecker(aliasesToCheck, ignoreExpressions);

            v.Visit(node);
            return(v.hasDependency);
        }
 internal override SqlNode Visit(SqlNode node) {
     // Short-circuit when the answer is alreading known
     if (this.referencesAnyMatchingAliases) {
         return node;
     }
     return base.Visit(node);
 }
Пример #19
0
        internal override SqlNode Visit(SqlNode node)
        {
            SqlExpression expression = node as SqlExpression;

            if (expression != null)
            {
                bool saveIsBlocked = this.isBlocked;
                this.isBlocked = false;
                if (CanRecurseColumnize(expression))
                {
                    base.Visit(expression);
                }
                if (!this.isBlocked)
                {
                    if (CanBeColumn(expression))
                    {
                        this.candidates.Add(expression);
                    }
                    else
                    {
                        this.isBlocked = true;
                    }
                }
                this.isBlocked |= saveIsBlocked;
            }
            return(node);
        }
Пример #20
0
        private void ProcessNode(Node node)
        {
            var sqlNode = new SqlNode
            {
                Id             = node.Id,
                TimeStamp      = node.TimeStamp,
                LocalChangeset = node.LocalChangeset,
                Latitude       = node.Latitude,
                Longtitude     = node.Longtitude,
            };

            sqlNode.MakePosition();

            var command = new SqlCommand("Insert into Node (Id, TimeStamp, Latitude, Longtitude, Position) values (@Id, @TimeStamp, @Latitude, @Longtitude, @Position)")
            {
                Connection = _db
            };

            command.Parameters.Add(new SqlParameter("@Id", sqlNode.Id));
            command.Parameters.Add(new SqlParameter("@TimeStamp", sqlNode.TimeStamp));
            command.Parameters.Add(new SqlParameter("@LocalChangeset", sqlNode.LocalChangeset));
            command.Parameters.Add(new SqlParameter("@Latitude", sqlNode.Latitude));
            command.Parameters.Add(new SqlParameter("@Longtitude", sqlNode.Longtitude));
            command.Parameters.Add(new SqlParameter("@Position", sqlNode.Position)
            {
                UdtTypeName = "Geography"
            });

            command.ExecuteNonQuery();
        }
Пример #21
0
        public void ProcessConstant(SqlNode constant, bool resolveIdent)
        {
            // If the constant is an IDENT, figure out what it means...
            bool isIdent = (constant.Type == HqlSqlWalker.IDENT || constant.Type == HqlSqlWalker.WEIRD_IDENT);

            if (resolveIdent && isIdent && IsAlias(constant.Text))
            {
                // IDENT is a class alias in the FROM.
                IdentNode ident = (IdentNode)constant;
                // Resolve to an identity column.
                ident.Resolve(false, true);
            }
            else
            {
                // IDENT might be the name of a class.
                IQueryable queryable = _walker.SessionFactoryHelper.FindQueryableUsingImports(constant.Text);
                if (isIdent && queryable != null)
                {
                    constant.Text = queryable.DiscriminatorSQLValue;
                }
                // Otherwise, it's a literal.
                else
                {
                    ProcessLiteral(constant);
                }
            }
        }
Пример #22
0
            internal override SqlNode Visit(SqlNode node) {
                if (node == null)
                    return null;

                sourceExpression = node as SqlExpression;
                if (sourceExpression != null) {
                    Type type = sourceExpression.ClrType;
                    UnwrapStack unwrap = this.UnwrapSequences;
                    while (unwrap != null) {
                        if (unwrap.Unwrap) {
                            type = TypeSystem.GetElementType(type);
                        }
                        unwrap = unwrap.Last;
                    }
                    sourceType = type;
                }
                if (sourceType != null && TypeSystem.GetNonNullableType(sourceType).IsValueType) {
                    return node; // Value types can't also have a dynamic type.
                }
                if (sourceType != null && TypeSystem.HasIEnumerable(sourceType)) {
                    return node; // Sequences can't be polymorphic.
                }

                switch (node.NodeType) {
                    case SqlNodeType.ScalarSubSelect:
                    case SqlNodeType.Multiset:
                    case SqlNodeType.Element:
                    case SqlNodeType.SearchedCase:
                    case SqlNodeType.ClientCase:
                    case SqlNodeType.SimpleCase:
                    case SqlNodeType.Member:
                    case SqlNodeType.DiscriminatedType:
                    case SqlNodeType.New:
                    case SqlNodeType.FunctionCall:
                    case SqlNodeType.MethodCall:
                    case SqlNodeType.Convert: // Object identity does not survive convert. It does survive Cast.
                        // Dig no further.
                        return node;
                    case SqlNodeType.TypeCase:
                        sourceType = ((SqlTypeCase)node).RowType.Type;
                        return node;
                    case SqlNodeType.Link:
                        sourceType = ((SqlLink)node).RowType.Type;
                        return node;
                    case SqlNodeType.Table:
                        sourceType = ((SqlTable)node).RowType.Type;
                        return node;
                    case SqlNodeType.Value:
                        SqlValue val = (SqlValue)node;
                        if (val.Value != null) {
                            // In some cases the ClrType of a Value node may
                            // differ from the actual runtime type of the value.
                            // Therefore, we ensure here that the correct type is set.
                            sourceType = val.Value.GetType();
                        }
                        return node;
                }
                return base.Visit(node);
            }
Пример #23
0
            SqlNode VisitJoinRight(SqlNode join)
            {
                this.sb.Append("(");
                var result = base.Visit(join);

                this.sb.Append(")");
                return(result);
            }
 internal QueryInfo(SqlNode query, string commandText, ReadOnlyCollection <SqlParameterInfo> parameters, ResultShape resultShape, Type resultType)
 {
     this.query       = query;
     this.commandText = commandText;
     this.parameters  = parameters;
     this.resultShape = resultShape;
     this.resultType  = resultType;
 }
Пример #25
0
 internal SqlNode Deflate(SqlNode node) {
     node = this.vDeflator.Visit(node);
     node = this.cDeflator.Visit(node);
     node = this.aDeflator.Visit(node);
     node = this.tsDeflator.Visit(node);
     node = this.dupColumnDeflator.Visit(node);
     return node;
 }
Пример #26
0
 /// <summary>
 /// Whether the given node has annotations.
 /// </summary>
 internal bool NodeIsAnnotated(SqlNode node)
 {
     if (node == null)
     {
         return(false);
     }
     return(this.annotationMap.ContainsKey(node));
 }
Пример #27
0
 internal SqlNode Prebind(SqlNode node)
 {
     if (this.prebinder != null)
     {
         node = this.prebinder(node);
     }
     return(node);
 }
        /// <summary>
        /// Returns true iff the given node references any aliases the list of 'aliases'.
        /// </summary>
        internal static bool ReferencesAny(SqlNode node, IEnumerable <SqlAlias> aliases)
        {
            Visitor visitor = new Visitor();

            visitor.aliases = aliases;
            visitor.Visit(node);
            return(visitor.referencesAnyMatchingAliases);
        }
Пример #29
0
        public virtual void Visit(SqlNode sqlNode)
        {
            if (sqlNode == null)
            {
                return;
            }

            sqlNode.Accept(this);
        }
Пример #30
0
        internal static SqlNode Reduce(SqlNode node, SqlNodeAnnotations annotations, Enum[] providerModesWithIncompatibilities)
        {
            Reducer r = new Reducer(providerModesWithIncompatibilities)
            {
                Annotations = annotations
            };

            return(r.Visit(node));
        }
Пример #31
0
        // Methods
        internal static MetaType GetSourceMetaType(SqlNode node, MetaModel model)
        {
            Visitor visitor = new Visitor();

            visitor.Visit(node);
            Type nonNullableType = TypeSystem.GetNonNullableType(visitor.sourceType);

            return(model.GetMetaType(nonNullableType));
        }
Пример #32
0
 /// <summary>
 /// start the enginges.
 /// </summary>
 /// <param name="node">the start node.</param>
 /// <returns>think of</returns>
 internal List <AnalyseResult> Run(SqlNode node)
 {
     if ((object)node == null)
     {
         return(null);
     }
     node.Accept(this);
     return(this._AnalyseResults);
 }
 internal override SqlNode Visit(SqlNode node)
 {
     node = base.Visit(node);
     if (node != null)
     {
         node.ClearSourceExpression();
     }
     return(node);
 }
 internal override SqlNode Visit(SqlNode node)
 {
     // Short-circuit when the answer is alreading known
     if (this.referencesAnyMatchingAliases)
     {
         return(node);
     }
     return(base.Visit(node));
 }
Пример #35
0
 internal string Format(SqlNode node, bool isDebug) {
     this.sb = new StringBuilder();
     this.isDebugMode = isDebug;
     this.aliasMap.Clear();
     if (isDebug) {
         new AliasMapper(this.aliasMap).Visit(node);
     }
     this.Visit(node);
     return this.sb.ToString();
 }
 internal override SqlNode Visit(SqlNode node) {
     if (annotations.NodeIsAnnotated(node)) {
         foreach (SqlNodeAnnotation annotation in annotations.Get(node)) {
             SqlServerCompatibilityAnnotation ssca = annotation as SqlServerCompatibilityAnnotation;
             if (ssca != null && ssca.AppliesTo(provider)) {
                 reasons.Add(annotation.Message);
             }
         }
     }
     return base.Visit(node);
 }
Пример #37
0
 internal override SqlNode Visit(SqlNode node) {
     if (node == null) {
         return null;
     }
     SqlNode result = null;
     if (this.nodeMap.TryGetValue(node, out result)) {
         return result;
     }
     result = base.Visit(node);
     this.nodeMap[node] = result;
     return result;
 }
        /// <summary>
        /// Add an annotation to the given node.
        /// </summary>
        internal void Add(SqlNode node, SqlNodeAnnotation annotation) {
            List<SqlNodeAnnotation> list = null;
            
            if (!this.annotationMap.TryGetValue(node, out list)) {
                list = new List<SqlNodeAnnotation>();
                this.annotationMap[node]=list;
            }

            uniqueTypes[annotation.GetType()] = String.Empty;

            list.Add(annotation);
        }
Пример #39
0
 internal static SqlNode Copy(SqlNode node) {
     if (node == null)
         return null;
     switch (node.NodeType) {
         case SqlNodeType.ColumnRef:
         case SqlNodeType.Value:
         case SqlNodeType.Parameter:
         case SqlNodeType.Variable:
             return node;
         default:
             return new SqlDuplicator().Duplicate(node);
     }
 }
        /// <summary>
        /// Checks whether the given node is supported on the given server.
        /// </summary>
        internal static void ThrowIfUnsupported(SqlNode node, SqlNodeAnnotations annotations, SqlProvider.ProviderMode provider) {
            // Check to see whether there's at least one SqlServerCompatibilityAnnotation.
            if (annotations.HasAnnotationType(typeof(SqlServerCompatibilityAnnotation))) {
                Visitor visitor = new Visitor(provider);
                visitor.annotations = annotations;
                visitor.Visit(node);

                // If any messages were recorded, then throw an exception.
                if (visitor.reasons.Count > 0) {
                    throw Error.ExpressionNotSupportedForSqlServerVersion(visitor.reasons);
                }
            }
        }
 internal static bool CanConvert(SqlNode node) {
     SqlBinary bo = node as SqlBinary;
     if (bo != null && (IsCompareToValue(bo) || IsVbCompareStringEqualsValue(bo))) {
         return true;
     }
     SqlMember sm = node as SqlMember;
     if (sm != null && IsSupportedMember(sm)) {
         return true;
     }
     SqlMethodCall mc = node as SqlMethodCall;
     if (mc != null && (IsSupportedMethod(mc) || IsSupportedVbHelperMethod(mc))) {
         return true;
     }
     return false;
 }
Пример #42
0
 internal override SqlNode Visit(SqlNode node) {
     SqlExpression expr = node as SqlExpression;
     if (expr != null) {
         if (this.candidates.Contains(expr)) {
             if (expr.NodeType == SqlNodeType.Column ||
                 expr.NodeType == SqlNodeType.ColumnRef) {
                 return expr;
             }
             else {
                 return new SqlColumn(expr.ClrType, expr.SqlType, null, null, expr, expr.SourceExpression);
             }
         }
     }
     return base.Visit(node);
 }
 internal static bool CanConvert(SqlNode node) {
     SqlUnary su = node as SqlUnary;
     if (su != null && IsSupportedUnary(su)) {
         return true;
     }
     SqlNew sn = node as SqlNew;
     if (sn != null && IsSupportedNew(sn)) {
         return true;
     }
     SqlMember sm = node as SqlMember;
     if (sm != null && IsSupportedMember(sm)) {
         return true;
     }
     SqlMethodCall mc = node as SqlMethodCall;
     if (mc != null && (GetMethodSupport(mc) == MethodSupport.Method)) {
         return true;
     }
     return false;
 }
Пример #44
0
 internal override SqlNode Visit(SqlNode node) {
     SqlExpression expression = node as SqlExpression;
     if (expression != null) {
         bool saveIsBlocked = this.isBlocked;
         this.isBlocked = false;
         if (CanRecurseColumnize(expression)) {
             base.Visit(expression);
         }
         if (!this.isBlocked) {
             if (CanBeColumn(expression)) {
                 this.candidates.Add(expression);
             }
             else {
                 this.isBlocked = true;
             }
         }
         this.isBlocked |= saveIsBlocked;
     }
     return node;
 }
Пример #45
0
 internal override string Format(SqlNode node) {
     return this.visitor.Format(node);
 }
Пример #46
0
 private GroupInfo FindGroupInfo(SqlNode source) {
     GroupInfo info = null;
     this.gmap.TryGetValue(source, out info);
     if (info != null) {
         return info;
     }
     SqlAlias alias = source as SqlAlias;
     if (alias != null) {
         SqlSelect select = alias.Node as SqlSelect;
         if (select != null) {
             return this.FindGroupInfo(select.Selection);
         }
         // it might be an expression (not yet fully resolved)
         source = alias.Node;
     }
     SqlExpression expr = source as SqlExpression;
     if (expr != null) {
         switch (expr.NodeType) {
             case SqlNodeType.AliasRef:
                 return this.FindGroupInfo(((SqlAliasRef)expr).Alias);
             case SqlNodeType.Member:
                 return this.FindGroupInfo(((SqlMember)expr).Expression);
             default:
                 this.gmap.TryGetValue(expr, out info);
                 return info;
         }
     }
     return null;
 }
Пример #47
0
 internal override string Format(SqlNode node, bool isDebug) {
     return this.visitor.Format(node, isDebug);
 }
Пример #48
0
 private SqlSelect CoerceToSequence(SqlNode node) {
     SqlSelect select = node as SqlSelect;
     if (select == null) {
         if (node.NodeType == SqlNodeType.Value) {
             SqlValue sv = (SqlValue)node;
             // Check for ITables.
             ITable t = sv.Value as ITable;
             if (t != null) {
                 return this.CoerceToSequence(this.TranslateConstantTable(t, null));
             }
             // Check for IQueryable.
             IQueryable query = sv.Value as IQueryable;
             if (query != null) {
                 Expression fex = Funcletizer.Funcletize(query.Expression);
                 // IQueryables that return self-referencing Constant expressions cause infinite recursion
                 if (fex.NodeType != ExpressionType.Constant ||
                     ((ConstantExpression)fex).Value != query) {
                     return this.VisitSequence(fex);
                 }
                 throw Error.IQueryableCannotReturnSelfReferencingConstantExpression();
             }
             throw Error.CapturedValuesCannotBeSequences();
         }
         else if (node.NodeType == SqlNodeType.Multiset || node.NodeType == SqlNodeType.Element) {
             return ((SqlSubSelect)node).Select;
         }
         else if (node.NodeType == SqlNodeType.ClientArray) {
             throw Error.ConstructedArraysNotSupported();
         }
         else if (node.NodeType == SqlNodeType.ClientParameter) {
             throw Error.ParametersCannotBeSequences();
         }
         // this needs to be a sequence expression!
         SqlExpression sqlExpr = (SqlExpression)node;
         SqlAlias sa = new SqlAlias(sqlExpr);
         SqlAliasRef aref = new SqlAliasRef(sa);
         return new SqlSelect(aref, sa, this.dominatingExpression);
     }
     return select;
 }
Пример #49
0
        internal override SqlNode Visit(SqlNode node) {
            // recurse until we know we're invalid
            if (this.IsValid && node != null) {
                return base.Visit(node);
            }

            return node;
        }
Пример #50
0
 internal SqlNode Multiplex(SqlNode node) {
     return this.visitor.Visit(node);
 }
 /// <summary>
 /// Remove relative constants from OrderBy.
 /// </summary>
 internal static SqlNode Remove(SqlNode node) {
     return new Visitor().Visit(node);
 }
Пример #52
0
 internal virtual void VisitCrossJoinList(SqlNode node) {
     SqlJoin join = node as SqlJoin;
     if (join != null) {
         this.VisitCrossJoinList(join.Left);
         sb.Append(", ");
         this.VisitCrossJoinList(join.Right);
     } else {
         this.Visit(node);
     }
 }
Пример #53
0
 internal SqlNode Duplicate(SqlNode node) {
     return this.superDuper.Visit(node);
 }
 internal static SqlNode Simplify(SqlNode node, SqlFactory sql) {
     return new Visitor(sql).Visit(node);
 }
Пример #55
0
 internal string Format(SqlNode node) {
     return this.Format(node, false);
 }
Пример #56
0
 internal SqlNode Flatten(SqlNode node) {
     node = this.visitor.Visit(node);
     return node;
 }
Пример #57
0
 internal virtual bool IsSimpleCrossJoinList(SqlNode node) {
     SqlJoin join = node as SqlJoin;
     if (join != null) {
         return join.JoinType == SqlJoinType.Cross &&
             this.IsSimpleCrossJoinList(join.Left) &&
             this.IsSimpleCrossJoinList(join.Right);
     }
     SqlAlias alias = node as SqlAlias;
     return (alias != null && alias.Node is SqlTable);
 }
 internal static SqlNode Lift(SqlNode node) {
     ColumnLifter cl = new ColumnLifter();
     node = cl.Visit(node);
     return node;
 }
Пример #59
0
 internal SqlNode Retype(SqlNode node) {
     return this.visitor.Visit(node);
 }
Пример #60
0
 internal SqlNode Reorder(SqlNode node) {
     return new Visitor(this.typeProvider, this.sql).Visit(node);
 }