public string ToSQLAdd(Constraint.ConstraintType type) { StringBuilder sql = new StringBuilder(); for (int index = 0; index < this.Count; index++) { if (this[index].Type == type) { sql.Append(this[index].ToSqlAdd()); sql.Append("\r\n"); } } return(sql.ToString()); }
public Constraint Get(Constraint.ConstraintType type, string columnName) { for (int index = 0; index < this.Count; index++) { if (this[index].Type == Constraint.ConstraintType.Default) { if (this[index].Columns[0].Name.Equals(columnName)) { return(this[index]); } } } return(null); }
private Point method_15(Constraint constraint_0, List <DelaunayTriangulation2d.Class15> nodes, ref bool bool_1) { bool_1 = false; Edge edge = constraint_0.Edge; Constraint.ConstraintType type = constraint_0.Type; int i = 0; while (i < nodes.Count) { Edge edge2 = nodes[i].method_12().method_15(nodes[i].method_12().method_19(edge.StartPoint)); if (!ConformingDelaunayTriangulation2d.smethod_0(edge, edge2)) { i++; } else { Point point; if (type == Constraint.ConstraintType.Boundary) { point = edge2.ToLine().getInterSecttion(new Plane(edge.StartPoint, edge.method_9(), new Vector3d(0.0, 0.0, 1.0))); } else { point = edge.ToLine().getInterSecttion(new Plane(edge2.StartPoint, edge2.method_9(), new Vector3d(0.0, 0.0, 1.0))); } if (point == null) { throw new ArithmeticException("Constraint/boundary intersection with triangle failed at following edge:\n" + constraint_0.ToString()); } if (ConformingDelaunayTriangulation2d.DistanceXY(edge2.StartPoint, point) < Global.AbsoluteEpsilon) { bool_1 = true; edge2.StartPoint.Z = point.Z; return(edge2.StartPoint); } if (ConformingDelaunayTriangulation2d.DistanceXY(edge2.EndPoint, point) < Global.AbsoluteEpsilon) { bool_1 = true; edge2.EndPoint.Z = point.Z; return(edge2.EndPoint); } return(point); } } throw new System.Exception("A degenerate triangle occurred along the following edge:\n" + constraint_0.ToString()); }
public string ToSql(Constraint.ConstraintType type) { StringBuilder sql = new StringBuilder(); for (int index = 0; index < this.Count; index++) { if (this[index].Type == type) { sql.Append("\t" + this[index].ToSql()); if (index != this.Count - 1) { sql.Append(","); } sql.Append("\r\n"); } } return(sql.ToString()); }
/// <summary> /// Writes the upgrade script_ table constraints. /// </summary> /// <param name="writer">The writer.</param> /// <param name="table">The table.</param> /// <param name="type">The type.</param> /// <param name="ForceCreation">if set to <c>true</c> [force creation].</param> private void writeUpgradeScript_TableConstraints(TextWriter writer, Table table, Constraint.ConstraintType type, Boolean ForceCreation) { foreach (Constraint cnst in table.ConstraintCont.Constraints) { if ((cnst.Qualifier == Qualifiable.Modification.Created || ForceCreation) && m_Configuration.UpgradeAllowConstraintCreate) { String line = String.Empty; switch (cnst.Type) { case Constraint.ConstraintType.PrimaryKey: { if (type == Constraint.ConstraintType.PrimaryKey) { line = String.Format("ALTER TABLE [{0}] WITH NOCHECK ADD CONSTRAINT [{1}] PRIMARY KEY ({2});", table.Name, cnst.Name, Constraint.getFieldList(cnst.FieldNames)); } } break; case Constraint.ConstraintType.Check: { if (type == Constraint.ConstraintType.Check) { line = String.Format("ALTER TABLE [{0}] WITH NOCHECK ADD CONSTRAINT [{1}] CHECK {2};", table.Name, cnst.Name, cnst.Text); } } break; case Constraint.ConstraintType.Unique: { if (type == Constraint.ConstraintType.Unique) { line = String.Format("ALTER TABLE [{0}] WITH NOCHECK ADD CONSTRAINT [{1}] UNIQUE ({2});", table.Name, cnst.Name, Constraint.getFieldList(cnst.FieldNames)); } } break; case Constraint.ConstraintType.ForeignKey: { if (type == Constraint.ConstraintType.ForeignKey) { line = String.Format ( "ALTER TABLE [{0}] WITH NOCHECK ADD CONSTRAINT [{1}] FOREIGN KEY ({2}) REFERENCES [{3}] ({4});", table.Name, cnst.Name, Constraint.getFieldList(cnst.FieldNames), cnst.ReferencedTable, Constraint.getFieldList(cnst.ReferencedFieldNames) ); } } break; } if (line != String.Empty) { writer.WriteLine(line); } } else if (cnst.Qualifier == Qualifiable.Modification.Deleted && m_Configuration.UpgradeAllowConstraintDrop) { String line = String.Format("ALTER TABLE [{0}] DROP CONSTRAINT [{1}];", table.Name, cnst.Name); writer.WriteLine(line); } } }
public Constraint(Edge edge, Constraint.ConstraintType type) { this.edge_0 = edge; this.constraintType = type; }