//======================================================================================== // Discover() // Although hasDiscovery is set to false for this type, we'll use the Discover // method to kick start our Configuration process. //======================================================================================== internal override void Discover() { Logger.WriteSection("SCHEMATA"); Statusbar.Message = "Discovering database schema..."; Nodes.Clear(); DataTable schemata = dbase.OraConnection.GetSchema("Users"); SchemataSchema schema; foreach (DataRow row in schemata.Rows) { schema = new SchemataSchema(dbase, row["NAME"].ToString()); schema.AddProperty("Name", row["NAME"].ToString()); //schema.AddProperty("Create Date", row["CREATEDATE"]); Nodes.Add(schema); Logger.WriteRowData(row); } Statusbar.Message = String.Empty; isDiscovered = true; }
/// <summary> /// Builds a collection of SchemataSchema items representing the selectable /// schemas for the specified database connection. /// </summary> /// <param name="con">The database connection to examine</param> /// <returns></returns> public SchemataSchema[] GetDatabaseSchemas(DatabaseConnection con) { // find the node for this connection bool found = false; int i = 0; while ((i < tree.Nodes.Count) && !found) { if (!(found = ((SchemataServer)tree.Nodes[i]).DatabaseConnection.Equals(con))) { i++; } } // we should fine it! if not, we've got a big problem! TreeNode server = tree.Nodes[i]; SchemataSchema[] schemas = new SchemataSchema[server.Nodes.Count]; for (int s = 0; s < server.Nodes.Count; s++) { schemas[s] = (SchemataSchema)server.Nodes[s]; } return(schemas); }
private SchemataParameter[] FindProcParameters( string serverName, string schemaName, string procName) { SchemataProcedure procedure = null; SchemataServer server = FindServer(serverName); if (server != null) { SchemataSchema schema = server.FindSchema(schemaName); if (schema != null) { procedure = schema.FindProcedure(procName); } } return(procedure == null ? new SchemataParameter[0] : procedure.Parameters); }
//======================================================================================== // FindSchema() //======================================================================================== internal SchemataSchema FindSchema(string schemaName) { int i = 0; bool found = false; SchemataSchema schema = null; schemaName = schemaName.ToLower(); while ((i < this.Nodes.Count) && !found) { schema = (SchemataSchema)this.Nodes[i]; if (!(found = schema.Text.ToLower().Equals(schemaName))) { i++; } } return(found ? schema : null); }
public SchemaItem(SchemataSchema node) { this.node = node; this.text = node.Parent.Text + "." + node.Text; }