Exemple #1
0
        public TableDetail(ObjectSchema AObject, DesignerControl ADesigner) : base(AObject, ADesigner)
        {
            Size       = new Size(300, 350);
            TextVAlign = VerticalAlignment.Top;

            // Get all columns
            TableSchema.ColumnSchemaEnumerator LColumns = BaseTableVar.GetColumns();
            while (LColumns.MoveNext())
            {
                AddColumnDesigner(LColumns.Current);
            }

            // Get all keys
            TableSchema.KeySchemaEnumerator LKeys = BaseTableVar.GetKeys();
            while (LKeys.MoveNext())
            {
                AddKeyDesigner(LKeys.Current);
            }

            // Get all Orders
            TableSchema.OrderSchemaEnumerator LOrders = BaseTableVar.GetOrders();
            while (LOrders.MoveNext())
            {
                AddOrderDesigner(LOrders.Current);
            }
        }
        public static TableVar NativeTableToTableVar(Plan plan, NativeTableValue nativeTable)
        {
            TableType tableType = new TableType();

            foreach (Column column in NativeColumnsToColumns(plan.DataTypes, nativeTable.Columns))
            {
                tableType.Columns.Add(column);
            }

            BaseTableVar tableVar = new BaseTableVar(tableType);

            tableVar.EnsureTableVarColumns();
            if (nativeTable.Keys != null)
            {
                foreach (NativeKey nativeKey in nativeTable.Keys)
                {
                    Key key = new Key();
                    foreach (string columnName in nativeKey.KeyColumns)
                    {
                        key.Columns.Add(tableVar.Columns[columnName]);
                    }
                    tableVar.Keys.Add(key);
                }
            }
            Compiler.EnsureKey(plan, tableVar);
            return(tableVar);
        }