Inheritance: SqlBaseExpression
コード例 #1
0
        protected override Expression VisitForeignKeyConstraint(SqlForeignKeyConstraintExpression foreignKeyConstraintExpression)
        {
            var action = new SqlConstraintActionExpression(SqlConstraintActionType.Add, foreignKeyConstraintExpression);
            var ammendmentEpression = new SqlAlterTableExpression(currentTable.Table, action);

            ammendments.Add(ammendmentEpression);

            return null;
        }
コード例 #2
0
        protected virtual Expression VisitAlterTable(SqlAlterTableExpression alterTableExpression)
        {
            var newTable = this.Visit(alterTableExpression.Table);
            var newList  = this.VisitExpressionList(alterTableExpression.Actions);

            if (newTable != alterTableExpression.Table || newList != alterTableExpression.Actions)
            {
                return(new SqlAlterTableExpression(newTable, newList));
            }

            return(alterTableExpression);
        }
コード例 #3
0
        protected override Expression VisitAlterTable(SqlAlterTableExpression expression)
        {
            SqlAlterTableExpression current;
            if (!TryGetCurrent(expression, out current))
            {
                return expression;
            }

            if (!(this.result &= current.NodeType == expression.NodeType))
            {
                return expression;
            }

            if (!(this.result &= current.Type == expression.Type))
            {
                return expression;
            }

            this.currentObject = current.Table;
            this.Visit(expression.Table);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current.Actions;
            this.VisitExpressionList(expression.Actions);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current.ConstraintActions;
            this.VisitExpressionList(expression.ConstraintActions);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current;
            return expression;
        }
コード例 #4
0
ファイル: Sql92QueryFormatter.cs プロジェクト: ciker/Shaolinq
        protected override Expression VisitAlterTable(SqlAlterTableExpression alterTableExpression)
        {
            this.Write("ALTER TABLE ");
            this.Visit(alterTableExpression.Table);
            this.Write(" ");
            this.VisitExpressionList(alterTableExpression.Actions);
            this.WriteLine(";");

            return alterTableExpression;
        }
コード例 #5
0
		protected virtual Expression VisitAlterTable(SqlAlterTableExpression alterTableExpression)
		{
			var newTable = this.Visit(alterTableExpression.Table);
			var newList = this.VisitExpressionList(alterTableExpression.Actions);

			if (newTable != alterTableExpression.Table || newList != alterTableExpression.Actions)
			{
				return new SqlAlterTableExpression(newTable, newList);
			}

			return alterTableExpression;
		}
コード例 #6
0
		protected override Expression VisitAlterTable(SqlAlterTableExpression alterTableExpression)
		{
			this.Write("ALTER TABLE ");
			this.Visit(alterTableExpression.Table);
			this.Write(" ");

			if (alterTableExpression.ConstraintActions != null)
			{
				this.VisitExpressionList(alterTableExpression.ConstraintActions);
			}
			else if (alterTableExpression.Actions != null)
			{
				foreach (var action in alterTableExpression.Actions)
				{
					this.Visit(action);
				}
			}

			this.WriteLine(";");

			return alterTableExpression;
		}