Пример #1
0
 protected override Expression VisitUnary(UnaryExpression node)
 {
     _Code.Add(node.NodeType);
     _Code.Push();
     this.Visit(node.Operand);
     _Code.Pop();
     return(node);
 }
Пример #2
0
        /// <summary>
        /// SQL文を生成する
        /// </summary>
        /// <param name="context">生成先のコンテキスト</param>
        public void ToElementCode(ElementCode context)
        {
            if (this.Table != null)
            {
                context.Add(SqlKeyword.From);
                context.Push();
                this.Table.ToElementCode(context);
                context.Pop();
                context.Add(this.Table);
            }

            if (this.JoinNodes != null)
            {
                foreach (var join in this.JoinNodes)
                {
                    join.ToElementCode(context);
                }
            }

            if (this.WhereNode != null)
            {
                this.WhereNode.ToElementCode(context);
            }

            if (this.GroupByNode != null)
            {
                this.GroupByNode.ToElementCode(context);
            }

            if (this.OrderByNode != null)
            {
                this.OrderByNode.ToElementCode(context);
            }

            if (this.LimitNode != null)
            {
                this.LimitNode.ToElementCode(context);
            }
        }
Пример #3
0
        /// <summary>
        /// SQL文を生成する
        /// </summary>
        /// <param name="context">生成先のコンテキスト</param>
        public void ToElementCode(ElementCode context)
        {
            switch (this.JoinType)
            {
            case JoinType.Inner:
                context.Add(SqlKeyword.InnerJoin);
                break;

            case JoinType.Left:
                context.Add(SqlKeyword.LeftJoin);
                break;

            case JoinType.Right:
                context.Add(SqlKeyword.RightJoin);
                break;
            }
            context.Push();
            this.Table.ToElementCode(context);
            context.Pop();
            context.Add(this.Table);
            context.Add(SqlKeyword.On);
            context.Add(this.On);
        }