예제 #1
0
        public ForeignKeyInfo CloneForeignKey(TableInfo ownTable = null)
        {
            var res = new ForeignKeyInfo(ownTable ?? OwnerTable);

            res.Assign(this);
            return(res);
        }
예제 #2
0
 public virtual void CreateForeignKey(ForeignKeyInfo fk)
 {
     Put("^alter ^table %f ^add ", fk.OwnerTable);
     CreateForeignKeyCore(fk);
     EndCommand();
 }
예제 #3
0
 public virtual void DropForeignKey(ForeignKeyInfo fk)
 {
     DropConstraint(fk);
 }
예제 #4
0
 protected virtual void CreateForeignKeyCore(ForeignKeyInfo fk)
 {
     if (fk.ConstraintName != null) Put("^constraint %i ", fk.ConstraintName);
     Put("^foreign ^key (");
     ColumnRefs(fk.Columns);
     Put(") ^references %f", fk.RefTableFullName);
     if (fk.RefColumns != null)
     {
         WriteRaw("(");
         ColumnRefs(fk.RefColumns);
         WriteRaw(")");
     }
     string ondelete = fk.OnDeleteAction.SqlName();
     string onupdate = fk.OnUpdateAction.SqlName();
     if (ondelete != null) Put(" ^on ^delete %k", ondelete);
     if (onupdate != null) Put(" ^on ^update %k", onupdate);
 }
예제 #5
0
 public void CreateForeignKey(ForeignKeyInfo fk)
 {
     _database.FindTable(fk.OwnerTable).AddConstraint(fk);
 }
예제 #6
0
 public void DropForeignKey(ForeignKeyInfo fk)
 {
     _database.FindTable(fk.OwnerTable).DropConstraint(fk);
 }
예제 #7
0
 public ForeignKeyInfo CloneForeignKey(TableInfo ownTable = null)
 {
     var res = new ForeignKeyInfo(ownTable ?? OwnerTable);
     res.Assign(this);
     return res;
 }