Пример #1
0
 internal void Initialize(Interop.IStoredProcedure dmoSproc)
 {
     base.SetName(dmoSproc.GetName());
     base.SetCommandText(dmoSproc.GetText());
     base.SetCreationDate(DateTime.Parse(dmoSproc.GetCreateDate()));
 }
Пример #2
0
 private static Interop.ITable GetDmoTable(Interop.ITables dmoTables, string name)
 {
     Interop.ITable table = null;
     int count = dmoTables.GetCount();
     for (int i = 1; i <= count; i++)
     {
         table = dmoTables.Item(i, string.Empty);
         if (table.GetName().ToLower() == name.ToLower())
         {
             return table;
         }
     }
     return null;
 }
Пример #3
0
 internal void Initialize(Interop.ITable dmoTable)
 {
     base.SetName(dmoTable.GetName());
     base.SetCreationDate(DateTime.Parse(dmoTable.GetCreateDate()));
     base.SetLastModifiedDate(DateTime.MinValue);
 }
Пример #4
0
 private static void DeleteInternal(Interop.ITables dmoTables, string name)
 {
     Interop.ITable dmoTable = GetDmoTable(dmoTables, name);
     if (dmoTable != null)
     {
         Interop.IKeys keys = dmoTable.GetKeys();
         keys.Refresh(true);
         int count = keys.GetCount();
         ArrayList list = new ArrayList();
         for (int i = count; i > 0; i--)
         {
             if (keys.Item(i).GetType() == 3)
             {
                 list.Add(i);
             }
         }
         foreach (int num3 in list)
         {
             keys.Remove(num3);
         }
         int num4 = dmoTables.GetCount();
         for (int j = 1; j <= num4; j++)
         {
             Interop.IKeys keys2 = dmoTables.Item(j, "").GetKeys();
             keys2.Refresh(true);
             int num6 = keys2.GetCount();
             ArrayList list2 = new ArrayList();
             for (int k = num6; k > 0; k--)
             {
                 Interop.IKey key2 = keys2.Item(k);
                 if ((key2.GetType() == 3) && SqlHelper.TableNamesEqual(name, key2.GetReferencedTable()))
                 {
                     list2.Add(k);
                 }
             }
             foreach (int num8 in list2)
             {
                 keys2.Remove(num8);
             }
         }
         dmoTable.Remove();
     }
 }
Пример #5
0
 internal void Initialize(Interop.IColumn dmoColumn)
 {
     this.Name = dmoColumn.GetName();
     this.DataType = dmoColumn.GetPhysicalDatatype();
     SqlDataType sqlDataType = GetSqlDataType(this.DataType);
     this.AllowNulls = dmoColumn.GetAllowNulls();
     string text = dmoColumn.GetDRIDefault().GetText();
     if (((text != null) && text.StartsWith("(")) && text.EndsWith(")"))
     {
         this.DefaultValue = text.Substring(1, text.Length - 2);
     }
     else
     {
         this.DefaultValue = text;
     }
     if (SupportsRowGuid(sqlDataType))
     {
         this.IsRowGuid = dmoColumn.GetIsRowGuidCol();
     }
     if (SupportsNumericPrecision(sqlDataType))
     {
         this.NumericPrecision = dmoColumn.GetNumericPrecision();
     }
     if (SupportsNumericScale(sqlDataType))
     {
         this.NumericScale = dmoColumn.GetNumericScale();
     }
     if (SupportsSize(sqlDataType))
     {
         this.Size = dmoColumn.GetLength();
     }
     if (SupportsIdentity(sqlDataType, this.NumericScale))
     {
         this.IsIdentity = dmoColumn.GetIdentity();
         if (this.IsIdentity)
         {
             this.IdentityIncrement = dmoColumn.GetIdentityIncrement();
             this.IdentitySeed = dmoColumn.GetIdentitySeed();
         }
     }
     this.InPrimaryKey = dmoColumn.GetInPrimaryKey();
     foreach (Microsoft.Matrix.Packages.DBAdmin.DBEngine.Key key in base.Table.Keys)
     {
         if (((key.KeyType == KeyType.Unique) && (key.ReferencedColumns.Count == 1)) && (key.ReferencedColumns.GetValues(this.Name) != null))
         {
             this.IsUniqueKey = true;
         }
     }
 }