From d589b496506f12914c0371e5504afd9387e0043b Mon Sep 17 00:00:00 2001 From: Dickon Field Date: Mon, 11 Feb 2008 23:19:01 +0000 Subject: [PATCH] got mymeta working and table node additions to the table node work. MyMeta is really cool after all! git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2953 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Misc/ServerTools/DbControlController.cs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/AddIns/Misc/ServerTools/DbControlController.cs b/src/AddIns/Misc/ServerTools/DbControlController.cs index 2224619260..f2f263e8c8 100644 --- a/src/AddIns/Misc/ServerTools/DbControlController.cs +++ b/src/AddIns/Misc/ServerTools/DbControlController.cs @@ -52,11 +52,27 @@ namespace ICSharpCode.ServerTools OleDbConnection connection = null; if (OleDbConnectionService.TryGetConnection(s.Name, out connection)) { // now use mymeta to retrieve table metadata - MyMeta.dbRoot m = new MyMeta.dbRoot(); - - } - - + dbRoot m = new dbRoot(); + bool connected = m.Connect(dbDriver.SQL, s.ConnectionString); + if (!connected) { + MessageBox.Show("Could not connect", "Connect failed"); + return; + } + IDatabases dbs = m.Databases; + OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder(s.ConnectionString); + String dbName = null; + Object o = null; + builder.TryGetValue("Initial Catalog", out o); + dbName = (String)o; + IDatabase db = dbs[dbName]; + ITables tables = db.Tables; + foreach (ITable t in tables) { + // yes, much TODO: this does not update, it just adds + TableNode tableNode = new TableNode(); + tableNode.Header = t.Alias; + tablesNode.Items.Add(tableNode); + } + } } public void UpdateTableNode(DbConnectionNode dbNode, string connectionName)