Inheritance: ICustomTypeDescriptor
        public IndexColumnEditorDialog(List<IndexColumn> ic)
        {
            table = ic[0].OwningIndex.Table;
            indexColumns = ic;
            InitializeComponent();

            foreach (Column c in table.Columns)
            {
                if (!String.IsNullOrEmpty(c.ColumnName))
                    columnNames.Add(c.ColumnName);
            }

            for (int i=0; i < indexColumns.Count; i++)
            {
                IndexColumnGridRow row = new IndexColumnGridRow();
                row.ColumnName = indexColumns[i].ColumnName;
                row.SortOrder = indexColumns[i].SortOrder.ToString();
                gridRows.Add(row);
            }

            columnName.Items.Add("<None>");
            columnName.Items.AddRange((object[])columnNames.ToArray());

            sortOrder.Items.Add("Ascending");
            sortOrder.Items.Add("Descending");

            indexColumnBindingSource.DataSource = gridRows;
        }
Esempio n. 2
0
    public Table(TableNode node, DataRow row, DataTable columns)
    {
      owningNode = node;
      IsNew = row == null;

      Columns = new TablePartCollection<Column>();
      Indexes = new TablePartCollection<Index>();
      ForeignKeys = new TablePartCollection<ForeignKey>();

      // set some defaults that may be overridden with actual table data
      Engine = node.DefaultStorageEngine;
      PackKeys = PackKeysMethod.Default;
      Schema = node.Database;

      if (row != null)
        ParseTableData(row);
      if (columns != null)
        ParseColumns(columns);
      if (!IsNew)
      {
        LoadIndexes();
        LoadForeignKeys();
      }

      // now save our current values as old
      OldTable = new Table();
      ObjectHelper.Copy(this, OldTable);
      node.DataSaved += new EventHandler(node_DataSaved);
    }
Esempio n. 3
0
 public ForeignKey(Table t, DataRow keyData) : this (t)
 {
     isNew = keyData == null;
     if (!isNew)
     {
         ParseFKInfo(keyData);
         (this as ITablePart).Saved();
     }
 }
Esempio n. 4
0
 public Index(Table t, DataRow indexData) : this(t)
 {
     isNew = indexData == null;
     oldIndex = new Index(t);
     if (!isNew)
     {
         ParseIndexInfo(indexData);
         (this as ITablePart).Saved();
     }
 }
        private void PopulateList(Table table)
        {
            engineList = new List<string>();
            DataTable data = table.OwningNode.GetDataTable("SHOW ENGINES");

            foreach (DataRow row in data.Rows)
            {
                if (!row[1].Equals("NO"))
                    engineList.Add(row[0].ToString());
            }
        }
Esempio n. 6
0
    public TableIndexDialog(TableNode node)
    {
      tableNode = node;
      table = tableNode.Table;
      InitializeComponent();

      foreach (Index i in tableNode.Table.Indexes)
        indexList.Items.Add(i.Name);

      bool isOk = tableNode.Table.Columns.Count > 0 &&
                  !String.IsNullOrEmpty(tableNode.Table.Columns[0].ColumnName) &&
                  !String.IsNullOrEmpty(tableNode.Table.Columns[0].DataType);
      addButton.Enabled = isOk;
      deleteButton.Enabled = false;
      indexList.Enabled = isOk;
    }
 private void PopulateList(Table table)
 {
     collationData = table.OwningNode.GetDataTable("SHOW COLLATION");
 }
Esempio n. 8
0
 private Index(Table t)
 {
   table = t;
   isNew = true;
 }
Esempio n. 9
0
 private ForeignKey(Table t)
 {
     Table = t;
     SetName(String.Format("FK_{0}_{0}", t.Name), true);
     Columns = new List<FKColumnPair>();
 }
Esempio n. 10
0
    protected override void Load()
    {
      if (IsNew)
      {
        table = new Table(this, null, null);
        table.Name = Name;
      }
      else
      {
        DbConnection connection = (DbConnection)HierarchyAccessor.Connection.GetLockedProviderObject();
        string[] restrictions = new string[4] { null, connection.Database, Name, null };
        DataTable columnsTable = connection.GetSchema("Columns", restrictions);

        DataTable dt = connection.GetSchema("Tables", restrictions);
        table = new Table(this, dt.Rows[0], columnsTable);

        HierarchyAccessor.Connection.UnlockProviderObject();
      }
      OnDataLoaded();
    }