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(); Runtime.LoggingService.Error("TABLE " + originalTable.Name); Runtime.LoggingService.Error(" columns = " + columns.Count); Runtime.LoggingService.Error(" constraints = " + constraints.Count); try { foreach (ColumnSchema col in columns) { int dummy = col.Constraints.Count; //get column constraints Runtime.LoggingService.Error("CONSTRAINTS " + col.Name + " " + dummy); } } catch (Exception ee) { Runtime.LoggingService.Error(ee); Runtime.LoggingService.Error(ee.StackTrace); } 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(); }); }
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(); }); }
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 (); }); }
public static IndexSchemaCollection GetNonPkIndices(this IndexSchemaCollection indicies) { return(indicies.Where(x => !x.IsPkIndex()).ToIndexSchemaCollection()); }
public static object[] ToSchemaObject(this IndexSchemaCollection indices) { return(indices.Select(index => index.ToSchemaObject()).ToArray()); }
private static string[] ToNameArray(this IndexSchemaCollection indicies) { return(indicies.Select(index => index.Name).ToArray()); }
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 (); Runtime.LoggingService.Error ("TABLE " + originalTable.Name); Runtime.LoggingService.Error (" columns = " + columns.Count); Runtime.LoggingService.Error (" constraints = " + constraints.Count); try { foreach (ColumnSchema col in columns) { int dummy = col.Constraints.Count; //get column constraints Runtime.LoggingService.Error ("CONSTRAINTS " + col.Name + " " + dummy); } } catch (Exception ee) { Runtime.LoggingService.Error (ee); Runtime.LoggingService.Error (ee.StackTrace); } 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 (); }); }
public virtual IndexSchemaCollection GetTableIndexes (TableSchema table) { IndexSchemaCollection collection = new IndexSchemaCollection (); IPooledDbConnection conn = connectionPool.Request (); try { //restrictions: database, schema, table, name DataTable dt = conn.GetSchema (indexesCollectionString, null, table.SchemaName, table.Name); for (int r = 0; r < dt.Rows.Count; r++) { DataRow row = dt.Rows[r]; collection.Add (GetTableIndex (row, table)); } } catch (Exception e) { QueryService.RaiseException (e); } conn.Release (); return collection; }
public ColumnSchemaCollection GetRelationKeyColumns(TableKeySchemaCollection fkeys, IndexSchemaCollection indexes) { System.Diagnostics.Debugger.Break(); for (int j=0; j < fkeys.Count; j++) { bool skipkey = false; foreach(IndexSchema i in indexes) { if(i.MemberColumns.Contains(fkeys[j].ForeignKeyMemberColumns[0])) skipkey = true; } if(skipkey) continue; return fkeys[j].ForeignKeyMemberColumns; } return new ColumnSchemaCollection(); }