예제 #1
0
        private void InitializeThreaded(object state)
        {
            tables      = schemaProvider.GetTables();
            dataTypes   = schemaProvider.GetDataTypes();
            columns     = originalTable.Columns;
            constraints = originalTable.Constraints;
            triggers    = originalTable.Triggers;
            //TODO: indices
            indexes = new IndexSchemaCollection();

            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            builder.Append("Loading editor for TABLE ");
            builder.Append(originalTable.Name);
            builder.AppendLine();
            builder.Append("    columns = ");
            builder.Append(columns.Count);
            builder.AppendLine();
            builder.Append("constraints = ");
            builder.Append(constraints.Count);
            builder.AppendLine();

            try {
                foreach (ColumnSchema col in columns)
                {
                    int dummy = col.Constraints.Count;                     //get column constraints
                    builder.Append("CONSTRAINTS ");
                    builder.Append(col.Name);
                    builder.Append(" ");
                    builder.Append(dummy);
                    builder.AppendLine();
                }
                LoggingService.LogDebug(builder.ToString());
            } catch (Exception ee) {
                LoggingService.LogDebug(builder.ToString());
                LoggingService.LogError(ee.ToString());
            }

            if (action == SchemaActions.Alter)             //make a duplicate if we are going to alter the table
            {
                this.table = originalTable.Clone() as TableSchema;
            }

            DispatchService.GuiDispatch(delegate() {
                InitializeGui();
            });
        }