public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (NamedObjectInfo)source; FullName = src.FullName; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ConstraintInfo)source; ConstraintName = src.ConstraintName; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (SchemaInfo)source; Name = src.Name; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (CheckInfo)source; Definition = src.Definition; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (TableInfo)source; if (src.PrimaryKey != null) { PrimaryKey = src.PrimaryKey.ClonePrimaryKey(this); } foreach (var fk in src.ForeignKeys) { ForeignKeys.Add(fk.CloneForeignKey(this)); } foreach (var ix in src.Indexes) { Indexes.Add(ix.CloneIndex(this)); } foreach (var ix in src.Uniques) { Uniques.Add(ix.CloneUnique(this)); } foreach (var ch in src.Checks) { Checks.Add(ch.CloneCheck(this)); } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (SpecificObjectInfo)source; CreateSql = src.CreateSql; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (TriggerInfo)source; TableOrView = src.TableOrView; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (IndexInfo) source; IsUnique = src.IsUnique; IndexType = src.IndexType; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ColumnInfo)source; Name = src.Name; DataType = src.DataType; DefaultValue = src.DefaultValue; DefaultConstraint = src.DefaultConstraint; NotNull = src.NotNull; AutoIncrement = src.AutoIncrement; PrimaryKey = src.PrimaryKey; Comment = src.Comment; IsPersisted = src.IsPersisted; ComputedExpression = src.ComputedExpression; IsSparse = src.IsSparse; if (src.CommonType != null) { CommonType = src.CommonType.Clone(); } else { CommonType = null; } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (IndexInfo)source; IsUnique = src.IsUnique; IndexType = src.IndexType; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ColumnsConstraintInfo) source; foreach(var col in src.Columns) { Columns.Add(col.Clone()); } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ProgrammableInfo)source; foreach(var par in src.Parameters) { Parameters.Add(par.Clone(this)); } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ViewInfo)source; if (src.QueryInfo != null) { QueryInfo = src.QueryInfo.Clone(); } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ColumnsConstraintInfo)source; foreach (var col in src.Columns) { Columns.Add(col.Clone()); } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ProgrammableInfo)source; foreach (var par in src.Parameters) { Parameters.Add(par.Clone(this)); } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ColumnListInfo)source; foreach (var col in src.Columns) { Columns.Add(col.CloneColumn((TableInfo)this)); } }
public virtual void Assign(DatabaseObjectInfo source) { foreach (var item in source.Properties) { Properties.Add(item.Key, item.Value); } ObjectId = source.ObjectId; GroupId = source.GroupId; CreateDate = source.CreateDate; ModifyDate = source.ModifyDate; }
public virtual void Assign(DatabaseObjectInfo source) { foreach (var item in source.Properties) { Properties.Add(item.Key, item.Value); } ObjectId = source.ObjectId; GroupId = source.GroupId; CreateDate = source.CreateDate; ModifyDate = source.ModifyDate; ModifyInfo = source.ModifyInfo; }
protected DatabaseObjectInfo GetPossibleTableObject(DatabaseObjectInfo newObject) { if (ParentTable != null) { DatabaseObjectInfo res = newObject.CloneObject(null); ((TableObjectInfo)res).SetDummyTable(ParentTable.FullName); return res; } else { return newObject; } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ForeignKeyInfo) source; OnUpdateAction = src.OnUpdateAction; OnDeleteAction = src.OnDeleteAction; RefTableName = src.RefTableName; RefSchemaName = src.RefSchemaName; foreach(var col in src.RefColumns) { RefColumns.Add(col.Clone()); } }
public void AssignPhaseData(DatabaseObjectInfo source, DatabaseAnalysePhase phase) { var src = (DatabaseInfo)source; if ((phase & DatabaseAnalysePhase.Tables) != 0) { Tables.Clear(); foreach (var obj in src.Tables) { Tables.Add(obj.CloneTable(this)); } } if ((phase & DatabaseAnalysePhase.Views) != 0) { Views.Clear(); foreach (var obj in src.Views) { Views.Add(obj.CloneView(this)); } } if ((phase & DatabaseAnalysePhase.Functions) != 0) { StoredProcedures.Clear(); Functions.Clear(); Triggers.Clear(); foreach (var obj in src.StoredProcedures) { StoredProcedures.Add(obj.CloneStoredProcedure(this)); } foreach (var obj in src.Functions) { Functions.Add(obj.CloneFunction(this)); } foreach (var obj in src.Triggers) { Triggers.Add(obj.CloneTrigger(this)); } } if ((phase & DatabaseAnalysePhase.Settings) != 0) { Schemas.Clear(); foreach (var obj in src.Schemas) { Schemas.Add(obj.CloneSchema(this)); } DefaultSchema = src.DefaultSchema; } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ForeignKeyInfo)source; OnUpdateAction = src.OnUpdateAction; OnDeleteAction = src.OnDeleteAction; RefTableName = src.RefTableName; RefSchemaName = src.RefSchemaName; foreach (var col in src.RefColumns) { RefColumns.Add(col.Clone()); } }
public void AddObject(DatabaseObjectInfo obj, bool reuseGrouId) { var col = obj as ColumnInfo; if (col != null) { var t = FindOrCreateTable(col.OwnerTable.FullName); t.AddColumn(col, reuseGrouId); return; } var cnt = obj as ConstraintInfo; if (cnt != null) { var t = FindOrCreateTable(col.OwnerTable.FullName); t.AddConstraint(cnt, reuseGrouId); return; } var tbl = obj as TableInfo; if (tbl != null) { AddTable(tbl, reuseGrouId); return; } var spe = obj as SpecificObjectInfo; if (spe != null) { AddSpecificObject(spe, reuseGrouId); return; } //var sch = obj as ISchemaStructure; //if (sch != null) //{ // AddSchema(sch, reuseGrouId); // return; //} //var dom = obj as IDomainStructure; //if (dom != null) //{ // AddDomain(dom, reuseGrouId); // return; //} }
public static void DropObject(this IAlterProcessor proc, DatabaseObjectInfo obj) { var tbl = obj as TableInfo; if (tbl != null) { proc.DropTable(tbl, false); return; } var col = obj as ColumnInfo; if (col != null) { proc.DropColumn(col); return; } var cnt = obj as ConstraintInfo; if (cnt != null) { proc.DropConstraint(cnt); return; } var spe = obj as SpecificObjectInfo; if (spe != null) { proc.DropSpecificObject(spe); return; } //var sch = obj as ISchemaStructure; //if (sch != null) //{ // proc.DropSchema(sch); // return; //} //var dom = obj as IDomainStructure; //if (dom != null) //{ // proc.DropDomain(dom); // return; //} }
protected static ObjectOperationCaps GetConstraintCaps(AlterProcessorCaps caps, DatabaseObjectInfo obj) { if (obj is IndexInfo) { return new ObjectOperationCaps { Create = caps.AddIndex, Drop = caps.DropIndex, Rename = caps.RenameIndex, Change = caps.ChangeIndex, }; } else { return new ObjectOperationCaps { Create = caps.AddConstraint, Drop = caps.DropConstraint, Rename = caps.RenameConstraint, Change = caps.ChangeConstraint, }; } }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (TriggerInfo) source; TableOrView = src.TableOrView; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ColumnInfo)source; Name = src.Name; DataType = src.DataType; DefaultValue = src.DefaultValue; DefaultConstraint = src.DefaultConstraint; Length = src.Length; NotNull = src.NotNull; Precision = src.Precision; Scale = src.Scale; AutoIncrement = src.AutoIncrement; PrimaryKey = src.PrimaryKey; Comment = src.Comment; IsPersisted = src.IsPersisted; ComputedExpression = src.ComputedExpression; IsSparse = src.IsSparse; if (src.CommonType != null) CommonType = src.CommonType.Clone(); else CommonType = null; }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return CloneFunction(owner as DatabaseInfo); }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (PrimaryKeyInfo) source; }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return(CloneDatabase()); }
//RenameSpecificObject public static void RenameObject(this IAlterProcessor proc, DatabaseObjectInfo obj, DbDiffOptions opts, NameWithSchema newName) { bool renameOk = false; //var dom = obj as IDomainStructure; //if (dom != null) //{ // renameOk = DbDiffTool.GenerateRename(dom.FullName, newName, // (old, sch) => proc.ChangeDomainSchema(old, sch), // (old, nam) => proc.RenameDomain(old, nam), // proc.AlterCaps.ChangeTableSchema, proc.AlterCaps.RenameDomain, opts); //} var tbl = obj as TableInfo; if (tbl != null) { renameOk = DbDiffTool.GenerateRename(tbl.FullName, newName, (old, sch) => proc.ChangeTableSchema(new TableInfo(null) {FullName = old}, sch), (old, nam) => proc.RenameTable(new TableInfo(null) {FullName = old}, nam), proc.AlterCaps.ChangeTableSchema, proc.AlterCaps.RenameTable, opts); } var col = obj as ColumnInfo; if (col != null) { if (proc.AlterCaps.RenameColumn) { proc.RenameColumn(col, newName.Name); renameOk = true; } } var cnt = obj as ConstraintInfo; if (cnt != null) { if (proc.AlterCaps.RenameConstraint) { proc.RenameConstraint(cnt, newName.Name); renameOk = true; } } var spec = obj as SpecificObjectInfo; if (spec != null) { renameOk = DbDiffTool.GenerateRenameSpecificObject(spec, newName, (old, sch) => proc.ChangeSpecificObjectSchema(old, sch), (old, nam) => proc.RenameSpecificObject(old, nam), proc.AlterCaps.GetSpecificObjectCaps(spec.ObjectType).ChangeSchema, proc.AlterCaps.GetSpecificObjectCaps(spec.ObjectType).Rename, opts); } if (!renameOk) throw new AlterNotPossibleError(); }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return(CloneUnique(owner as TableInfo)); }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return ClonePrimaryKey(owner as TableInfo); }
public virtual DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { throw new Exception(String.Format("DBSH-00211 Object {0} is not cloneable", GetType().FullName)); }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return(CloneSchema(owner as DatabaseInfo)); }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ConstraintInfo) source; ConstraintName = src.ConstraintName; }
public static void ChangeObject(this IAlterProcessor proc, DatabaseObjectInfo obj, DatabaseObjectInfo newObj) { var tbl = obj as TableInfo; if (tbl != null) { throw new AlterNotPossibleError(); } var col = obj as ColumnInfo; if (col != null) { proc.ChangeColumn(col, (ColumnInfo) newObj); return; } //var cnt = obj as ConstraintInfo; //if (cnt != null) //{ // proc.ChangeConstraint(cnt, (IConstraint) newObj); // return; //} //var spe = obj as ISpecificObjectStructure; //if (spe != null) //{ // proc.ChangeSpecificObject(spe, (ISpecificObjectStructure) newObj); // return; //} //var sch = obj as ISchemaStructure; //if (sch != null) //{ // proc.ChangeSchema(sch, (ISchemaStructure) newObj); // return; //} //var dom = obj as IDomainStructure; //if (dom != null) //{ // proc.ChangeDomain(dom, (IDomainStructure) newObj); // return; //} }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ColumnListInfo) source; foreach (var col in src.Columns) Columns.Add(col.CloneColumn((TableInfo) this)); }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return(CloneStoredProcedure(owner as DatabaseInfo)); }
public virtual DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { throw new Exception(String.Format("DBSH-00211 Object {0} is not cloneable", GetType().FullName)); }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (NamedObjectInfo) source; FullName = src.FullName; }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return CloneStoredProcedure(owner as DatabaseInfo); }
//public bool SourceColumnNullable //{ // get // { // WantInfo(); // if (m_srcObject != null) return ((IColumnStructure)m_srcObject).IsNullable; // return false; // } //} //public bool TargetColumnNullable //{ // get // { // WantInfo(); // if (m_dstObject != null) return ((IColumnStructure)m_dstObject).IsNullable; // return false; // } //} //public string SourceColumnType //{ // get // { // WantInfo(); // if (m_srcObject != null) return m_diff.Source.Dialect.GenericTypeToSpecific(((IColumnStructure)m_srcObject).DataType).ToString(); // return ""; // } //} //public string TargetColumnType //{ // get // { // WantInfo(); // if (m_dstObject != null) return m_diff.Target.Dialect.GenericTypeToSpecific(((IColumnStructure)m_dstObject).DataType).ToString(); // return ""; // } //} //public string ConstraintType //{ // get // { // WantInfo(); // return m_anyObject.GetName().ObjectType.ToString(); // } //} //public string SourceConstraintColumns //{ // get // { // var cnt = m_srcObject as ColumnsConstraintInfo; // if (cnt != null) return cnt.Columns.GetNames().CreateDelimitedText(","); // return null; // } //} //public string TargetConstraintColumns //{ // get // { // var cnt = m_dstObject as ColumnsConstraintInfo; // if (cnt != null) return cnt.Columns.GetNames().CreateDelimitedText(","); // return null; // } //} //public string ActionSqlTitle //{ // get // { // if (Operation != null) return Operation.ToString(); // return null; // } //} private void WantInfo() { if (m_anyObject != null) return; if (GroupId == null) return; m_srcObject = m_diff.FindSource(GroupId); m_dstObject = m_diff.FindTarget(GroupId); m_anyObject = m_srcObject ?? m_dstObject; //Errors.CheckNotNull("DAE-00364", m_anyObject); m_srcName = m_srcObject != null ? m_srcObject.GetName() : null; m_dstName = m_dstObject != null ? m_dstObject.GetName() : null; var name = m_anyObject.GetName(); }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); AssignPhaseData(source, DatabaseAnalysePhase.All); AfterLoadLink(); }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (TableInfo)source; if (src.PrimaryKey != null) PrimaryKey = src.PrimaryKey.ClonePrimaryKey(this); foreach (var fk in src.ForeignKeys) { ForeignKeys.Add(fk.CloneForeignKey(this)); } foreach (var ix in src.Indexes) { Indexes.Add(ix.CloneIndex(this)); } foreach (var ix in src.Uniques) { Uniques.Add(ix.CloneUnique(this)); } foreach (var ch in src.Checks) { Checks.Add(ch.CloneCheck(this)); } }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return(ClonePrimaryKey(owner as TableInfo)); }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (PrimaryKeyInfo)source; }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return(CloneTrigger(owner as DatabaseInfo)); }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return CloneForeignKey(owner as TableInfo); }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return(CloneFunction(owner as DatabaseInfo)); }
// this structure is incrementally loaded, when needed //int m_fixedOrderCounter = 0; public void RecreateObject(DatabaseObjectInfo recreatedObject, DatabaseObjectInfo newVersion) { foreach (var it in RecreatedItems) { if (it.RecreatedObject == recreatedObject) { if (it.NewVersion != null && newVersion != null) throw new InternalError("DBSH-00140 Two new versions of object " + recreatedObject.ToString()); it.NewVersion = newVersion ?? it.NewVersion; return; } } RecreatedItems.Add(new RecreatedItem { RecreatedObject = recreatedObject, NewVersion = newVersion }); }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return CloneColumn(owner as TableInfo); }
public void RecreateObject_Drop(DatabaseObjectInfo obj) { var cnt = obj as ConstraintInfo; if (cnt != null) DropConstraint(cnt, PlanPosition.Begin); var spec = obj as SpecificObjectInfo; if (spec != null) DropSpecificObject(spec, PlanPosition.Begin); var col = obj as ColumnInfo; if (col != null) DropColumn(col, PlanPosition.Begin); }
public override DatabaseObjectInfo CloneObject(DatabaseObjectInfo owner) { return CloneTrigger(owner as DatabaseInfo); }
public void RecreateObject_Create(DatabaseObjectInfo recreated, DatabaseObjectInfo newobj) { var cnt = newobj as ConstraintInfo; if (cnt != null) CreateConstraint(((ConstraintInfo)recreated).OwnerTable, cnt, PlanPosition.End); var spec = newobj as SpecificObjectInfo; if (spec != null) CreateSpecificObject(spec, PlanPosition.End); var col = newobj as ColumnInfo; if (col != null) CreateColumn(((ColumnInfo)recreated).OwnerTable, col, PlanPosition.End); }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (SchemaInfo) source; Name = src.Name; }
public override void Assign(DatabaseObjectInfo source) { base.Assign(source); var src = (ViewInfo) source; if (src.QueryInfo != null) QueryInfo = src.QueryInfo.Clone(); }