protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is TableConstraintNode)
                Constraint = (TableConstraintNode) node;

            return base.OnChildNode(node);
        }
Esempio n. 2
0
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is TableConstraintNode)
            {
                Constraint = (TableConstraintNode)node;
            }

            return(base.OnChildNode(node));
        }
Esempio n. 3
0
        private static SqlTableConstraint BuildConstraint(string tableName, TableConstraintNode constraint)
        {
            var objTableName = ObjectName.Parse(tableName);
            if (String.Equals(ConstraintTypeNames.Check, constraint.ConstraintType, StringComparison.OrdinalIgnoreCase)) {
                var exp = ExpressionBuilder.Build(constraint.CheckExpression);
                return new SqlTableConstraint(constraint.ConstraintName, ConstraintType.Check, constraint.Columns.ToArray()) {
                    CheckExpression = exp
                };
            }
            if (String.Equals(ConstraintTypeNames.PrimaryKey, constraint.ConstraintType, StringComparison.OrdinalIgnoreCase))
                return SqlTableConstraint.PrimaryKey(constraint.ConstraintName, constraint.Columns.ToArray());
            if (String.Equals(ConstraintTypeNames.UniqueKey, constraint.ConstraintType, StringComparison.OrdinalIgnoreCase))
                return SqlTableConstraint.UniqueKey(constraint.ConstraintName, constraint.Columns.ToArray());
            if (String.Equals(ConstraintTypeNames.ForeignKey, constraint.ConstraintType, StringComparison.OrdinalIgnoreCase)) {
                var fTable = constraint.ReferencedTableName.Name;
                var fColumns = constraint.ReferencedColumns;
                var onDelete = ForeignKeyAction.NoAction;
                var onUpdate = ForeignKeyAction.NoAction;

                if (!String.IsNullOrEmpty(constraint.OnDeleteAction))
                    onDelete = GetForeignKeyAction(constraint.OnDeleteAction);
                if (!String.IsNullOrEmpty(constraint.OnUpdateAction))
                    onUpdate = GetForeignKeyAction(constraint.OnUpdateAction);

                var fkey = SqlTableConstraint.ForeignKey(constraint.ConstraintName, constraint.Columns.ToArray(), fTable,
                    fColumns.ToArray(), onDelete, onUpdate);

                return fkey;
            }

            throw new NotSupportedException();
        }
Esempio n. 4
0
 public virtual void VisitTableConstraint(TableConstraintNode arg)
 {
 }
Esempio n. 5
0
 public virtual void VisitTableConstraint(TableConstraintNode arg)
 {
 }