void OnTreePopupMenu_View (object o, EventArgs args) { if(selectedDepth == 4) { switch(selectedType) { case "Procedures": case "Fuctions": case "Packages": case "Stored Procedures": case "External Procedures": Schema browser = new Schema (provider.Name, conn); string sql = browser.GetSource (selectedObject, selectedType); EditorTab etab = NewEditorTab (); TextBuffer buf = etab.editor.Buffer; TextIter endIter = buf.EndIter; buf.Insert (ref endIter, sql); buf.Modified = false; string basefile = ""; basefile = selectedType + " - " + selectedObject; etab.label.Text = basefile; etab.basefilename = basefile; UpdateTitleBar(etab); sourceFileNotebook.CurrentPage = -1; ComboHelper.SetActiveText (combo, selectedDataSource); AppendText(""); break; } } }
void OnDataTreeRowExpanded (object o, RowExpandedArgs args) { // 1 Connections // 2 conn1 // 2 conn2 // 3 Tables // 4 table_name_display1, is_populated_status, table_owner, table_name // 4 table_name_display2, is_populated_status, table_owner, table_name // 5 Columns // 6 column_name1 // 6 column_name2 // RowExpandedArgs has: // args.Iter // args.Path TreeModel model = (TreeModel) tree.Store; if (args.Path.Depth == 5) { string val = (string) model.GetValue (args.Iter, 0); if (val.Equals("Columns")) { TreeIter parent = args.Iter; TreeIter dataSourceIter = args.Iter; // get table name model.IterParent(out parent, args.Iter); string tableName = (string) tree.Store.GetValue (parent, 0); // tableName display string objOwner = (string) tree.Store.GetValue (parent, 2); // owner name string objName = (string) tree.Store.GetValue (parent, 3); // table name TreeIter iter; iter = parent; model.IterParent(out parent, iter); val = (string) tree.Store.GetValue (parent, 0); // Tables if (val.Equals("Tables")) { // get data source model.IterParent(out dataSourceIter, parent); string dataSourceName = (string) model.GetValue (dataSourceIter, 0); ComboHelper.SetActiveText (combo, dataSourceName); TreeIter columnsIter = args.Iter; string populated = (string) tree.Store.GetValue (args.Iter, 1); if (!populated.Equals(NotPopulated)) return; // setup schema browser Schema browser = new Schema (provider.Name, conn); if (browser.MetaData != null) { SetStatusBarText ("Getting Meta Data: Tables Columns..."); while (Application.EventsPending ()) Application.RunIteration (); // get table columns MetaTable table = new MetaTable (objOwner, objName); // owner, tablename PopulateTableColumns(columnsIter, table, browser); model.SetValue (args.Iter, 1, "Populated"); SetStatusBarText (""); // remove the NotPopulated node TreeIter popIter = columnsIter; if (tree.Store.IterChildren (out popIter, columnsIter)) tree.Store.Remove (ref popIter); } } } } }
public void PopulateTableColumns (TreeIter parentIter, MetaTable table, Schema browser) { MetaTableColumnCollection columns = browser.GetTableColumns(table.Owner, table.Name); foreach(MetaTableColumn column in columns) { string nullable; if(column.Nullable == true) nullable = "Null"; else nullable = "Not Null"; string line = column.Name + " (" + column.DataType + " (" + column.Length + ", " + column.Precision + ", " + column.Scale + "), " + nullable + ")"; tree.Store.AppendValues (parentIter, line, ""); } }
public void PopulateProcedures (TreeIter parentIter, Provider provider, IDbConnection con) { TreeIter procsIter = parentIter; Schema browser = new Schema (provider.Name, con); if (browser.MetaData != null) { SetStatusBarText ("Getting Meta Data: Procudures..."); while (Application.EventsPending ()) Application.RunIteration (); MetaProcedureCollection procs = browser.GetProcedures (""); string procType = "~"; foreach (MetaProcedure proc in procs) { if (!procType.Equals(proc.ProcedureType)) { procType = proc.ProcedureType; procsIter = tree.Store.AppendValues (parentIter, procType, ""); } TreeIter procIter = tree.Store.AppendValues (procsIter, proc.ToString(), ""); //if (proc.HasProcedures) // PopulatePackageProcedures (procIter, proc); //else // PopulateProcedureArguments (procIter, proc); } } }
public void PopulateViews (TreeIter parentIter, Provider provider, IDbConnection con) { TreeIter viewsIter = tree.Store.AppendValues (parentIter, "Views", ""); Schema browser = new Schema (provider.Name, con); if (browser.MetaData != null) { SetStatusBarText ("Getting Meta Data: Views..."); while (Application.EventsPending ()) Application.RunIteration (); MetaViewCollection views = browser.GetViews (true); foreach (MetaView view in views) tree.Store.AppendValues (viewsIter, view.ToString(), ""); } }
public void PopulateTables (TreeIter parentIter, Provider provider, IDbConnection con, bool IsParent) { TreeIter tablesIter = parentIter; if (IsParent == true) tablesIter = tree.Store.AppendValues (parentIter, "Tables", ""); Schema browser = new Schema (provider.Name, con); if (browser.MetaData != null) { SetStatusBarText ("Getting Meta Data: Tables..."); while (Application.EventsPending ()) Application.RunIteration (); MetaTableCollection tables = browser.GetTables (false); TreeIter iter; TreeIter columnsIter; foreach(MetaTable table in tables) { iter = tree.Store.AppendValues (tablesIter, table.ToString (), "", table.Owner, table.Name); columnsIter = tree.Store.AppendValues (iter, "Columns", NotPopulated); tree.Store.AppendValues (columnsIter, "NotPopulated", NotPopulated); //PopulateTableColumns(columnsIter, table, browser); } } }