Пример #1
0
 public void CreateConstraint(Func <DbCommand> commandCreator, AbstractConstraint constraint)
 {
     using (DbCommand command = commandCreator()) {
         command.CommandText = _SQLQueryManager.CreateConstraint(constraint);
         ExecuteNonQuery(command);
     }
 }
Пример #2
0
 /// <summary>
 /// SQL-92, page 292
 /// </summary>
 private string _DropTableConstraintDefinition(AbstractConstraint constraint)
 {
     return(string.Format(
                "DROP CONSTRAINT {0}",
                nameEscaper(constraint.name)
                ));
 }
Пример #3
0
 /// <summary>
 /// SQL-92, page 291
 /// </summary>
 private string _AddTableConstraintDefinition(AbstractConstraint constraint)
 {
     return(string.Format(
                "ADD {0}",
                _TableConstraintDefinition(constraint)
                ));
 }
Пример #4
0
 /// <summary>
 /// SQL-92, page 252
 /// </summary>
 private string _ConstraintNameDefinition(AbstractConstraint constraint)
 {
     return(string.Format(
                "CONSTRAINT {0}",
                nameEscaper(constraint.name)
                ));
 }
Пример #5
0
 public void RemoveConstraint(Func <DbCommand> commandCreator, AbstractConstraint constraint)
 {
     CheckConstraint(commandCreator, constraint);
     using (DbCommand command = commandCreator()) {
         command.CommandText = _SQLQueryManager.DropConstraint(constraint);
         ExecuteNonQuery(command);
     }
 }
Пример #6
0
 /// <summary>
 /// SQL-92, page 270
 /// </summary>
 private string _TableConstraintDefinition(AbstractConstraint constraint)
 {
     return(string.Format(
                "{0} {1}",
                _ConstraintNameDefinition(constraint),
                _TableConstraint(constraint)
                ));
 }
Пример #7
0
 private void CheckConstraint(Func <DbCommand> commandCreator, AbstractConstraint constraint)
 {
     constraint.Accept(fkc => CheckConstraint(commandCreator, fkc), uc => CheckConstraint(commandCreator, uc), cc => CheckConstraint(commandCreator, cc));
 }
Пример #8
0
 public string DropConstraint(AbstractConstraint constraint)
 {
     return(_AlterTableStatement(constraint.table, _DropTableConstraintDefinition(constraint)));
 }
Пример #9
0
 /// <summary>
 /// SQL-92, page 270
 /// </summary>
 private string _TableConstraint(AbstractConstraint constraint)
 {
     return(constraint.Accept <string>(_ReferentialConstraintDefinition, _UniqueConstraintDefinition, _CheckConstraintDefinition));
 }
Пример #10
0
 public void RemoveConstraint(AbstractConstraint constraint)
 {
     this.traits.RemoveConstraint(this.CreateTextCommand, constraint);
 }