miniSql

创建
zgc123@gmail.com authored at 11/19/2023 1:40:15 AM
6136600
Tree
0 Parent(s)
Summary: 18 changed files with 1771 additions and 0 deletions.
Added +28 -0
Added +38 -0
Added +38 -0
Added +38 -0
Added +38 -0
Added +70 -0
Added +38 -0
Added +41 -0
Added +34 -0
Added +47 -0
Added +69 -0
Added +553 -0
Added +120 -0
Added +161 -0
Added +53 -0
Added +203 -0
Added +82 -0
Added +120 -0
Added +28 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/CopyTableNameCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/CopyTableNameCommand.cs
new file mode 100644
index 0000000..ff20da0
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/CopyTableNameCommand.cs
@@ -0,0 +1,28 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System.Windows.Forms;
+using MiniSqlQuery.Core.Commands;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The copy table name command.</summary>
+    public class CopyTableNameCommand : CommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="CopyTableNameCommand"/> class.</summary>
+        public CopyTableNameCommand()
+            : base("Copy table name")
+        {
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            Clipboard.SetText(HostWindow.DatabaseInspector.RightClickedTableName);
+        }
+    }
+}
\ No newline at end of file
Added +38 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateDeleteStatementCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateDeleteStatementCommand.cs
new file mode 100644
index 0000000..e0b7220
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateDeleteStatementCommand.cs
@@ -0,0 +1,38 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System.IO;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.DbModel;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The generate delete statement command.</summary>
+    public class GenerateDeleteStatementCommand : GenerateStatementCommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="GenerateDeleteStatementCommand"/> class.</summary>
+        public GenerateDeleteStatementCommand()
+            : base("Generate Delete Statement")
+        {
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            IQueryEditor editor = ActiveFormAsSqlQueryEditor;
+            string tableName = HostWindow.DatabaseInspector.RightClickedTableName;
+            DbModelInstance model = HostWindow.DatabaseInspector.DbSchema;
+
+            if (tableName != null && editor != null)
+            {
+                StringWriter sql = new StringWriter();
+                SqlWriter.WriteDelete(sql, GetTableOrViewByName(model, tableName));
+                editor.InsertText(sql.ToString());
+            }
+        }
+    }
+}
\ No newline at end of file
Added +38 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateInsertStatementCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateInsertStatementCommand.cs
new file mode 100644
index 0000000..55f0802
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateInsertStatementCommand.cs
@@ -0,0 +1,38 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System.IO;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.DbModel;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The generate insert statement command.</summary>
+    internal class GenerateInsertStatementCommand : GenerateStatementCommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="GenerateInsertStatementCommand"/> class.</summary>
+        public GenerateInsertStatementCommand()
+            : base("Generate Insert Statement")
+        {
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            IQueryEditor editor = ActiveFormAsSqlQueryEditor;
+            string tableName = HostWindow.DatabaseInspector.RightClickedTableName;
+            DbModelInstance model = HostWindow.DatabaseInspector.DbSchema;
+
+            if (tableName != null && editor != null)
+            {
+                StringWriter sql = new StringWriter();
+                SqlWriter.WriteInsert(sql, GetTableOrViewByName(model, tableName));
+                editor.InsertText(sql.ToString());
+            }
+        }
+    }
+}
\ No newline at end of file
Added +38 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateSelectCountStatementCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateSelectCountStatementCommand.cs
new file mode 100644
index 0000000..14efcf5
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateSelectCountStatementCommand.cs
@@ -0,0 +1,38 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System.IO;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.DbModel;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The generate select count statement command.</summary>
+    public class GenerateSelectCountStatementCommand : GenerateStatementCommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="GenerateSelectCountStatementCommand"/> class.</summary>
+        public GenerateSelectCountStatementCommand()
+            : base("Generate Select COUNT(*) Statement")
+        {
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            IQueryEditor editor = ActiveFormAsSqlQueryEditor;
+            string tableName = HostWindow.DatabaseInspector.RightClickedTableName;
+            DbModelInstance model = HostWindow.DatabaseInspector.DbSchema;
+
+            if (tableName != null && editor != null)
+            {
+                StringWriter sql = new StringWriter();
+                SqlWriter.WriteSelectCount(sql, GetTableOrViewByName(model, tableName));
+                editor.InsertText(sql.ToString());
+            }
+        }
+    }
+}
\ No newline at end of file
Added +38 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateSelectStatementCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateSelectStatementCommand.cs
new file mode 100644
index 0000000..7265429
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateSelectStatementCommand.cs
@@ -0,0 +1,38 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System.IO;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.DbModel;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The generate select statement command.</summary>
+    public class GenerateSelectStatementCommand : GenerateStatementCommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="GenerateSelectStatementCommand"/> class.</summary>
+        public GenerateSelectStatementCommand()
+            : base("Generate Select Statement")
+        {
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            IQueryEditor editor = ActiveFormAsSqlQueryEditor;
+            string tableName = HostWindow.DatabaseInspector.RightClickedTableName;
+            DbModelInstance model = HostWindow.DatabaseInspector.DbSchema;
+
+            if (tableName != null && editor != null)
+            {
+                StringWriter sql = new StringWriter();
+                SqlWriter.WriteSelect(sql, GetTableOrViewByName(model, tableName));
+                editor.InsertText(sql.ToString());
+            }
+        }
+    }
+}
\ No newline at end of file
Added +70 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateStatementCommandBase.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateStatementCommandBase.cs
new file mode 100644
index 0000000..1464746
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateStatementCommandBase.cs
@@ -0,0 +1,70 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using MiniSqlQuery.Core.Commands;
+using MiniSqlQuery.Core.DbModel;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The generate statement command base.</summary>
+    public abstract class GenerateStatementCommandBase : CommandBase
+    {
+        /// <summary>The _sql writer.</summary>
+        private ISqlWriter _sqlWriter;
+
+        /// <summary>Initializes a new instance of the <see cref="GenerateStatementCommandBase"/> class.</summary>
+        /// <param name="name">The name.</param>
+        public GenerateStatementCommandBase(string name)
+            : base(name)
+        {
+        }
+
+        /// <summary>Gets SqlWriter.</summary>
+        protected ISqlWriter SqlWriter
+        {
+            get
+            {
+                if (_sqlWriter == null)
+                {
+                    _sqlWriter = Services.Resolve<ISqlWriter>();
+                }
+
+                return _sqlWriter;
+            }
+        }
+
+        /// <summary>The get table or view by name.</summary>
+        /// <param name="model">The model.</param>
+        /// <param name="tableName">The table name.</param>
+        /// <returns></returns>
+        protected DbModelTable GetTableOrViewByName(DbModelInstance model, string tableName)
+        {
+            DbModelTable tableOrView = model.FindTable(tableName);
+            if (tableOrView == null)
+            {
+                // check the views
+                tableOrView = model.FindView(tableName);
+            }
+
+            return tableOrView;
+        }
+
+        /// <summary>The trim trailing comma.</summary>
+        /// <param name="sql">The sql.</param>
+        /// <returns>The trim trailing comma.</returns>
+        protected string TrimTrailingComma(string sql)
+        {
+            if (sql != null && sql.TrimEnd().EndsWith(","))
+            {
+                string tmp = sql.TrimEnd();
+                return tmp.Substring(0, tmp.Length - 1);
+            }
+
+            return sql;
+        }
+    }
+}
\ No newline at end of file
Added +38 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateUpdateStatementCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateUpdateStatementCommand.cs
new file mode 100644
index 0000000..2f90fe6
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/GenerateUpdateStatementCommand.cs
@@ -0,0 +1,38 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System.IO;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.DbModel;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The generate update statement command.</summary>
+    internal class GenerateUpdateStatementCommand : GenerateStatementCommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="GenerateUpdateStatementCommand"/> class.</summary>
+        public GenerateUpdateStatementCommand()
+            : base("Generate Update Statement")
+        {
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            IQueryEditor editor = ActiveFormAsSqlQueryEditor;
+            string tableName = HostWindow.DatabaseInspector.RightClickedTableName;
+            DbModelInstance model = HostWindow.DatabaseInspector.DbSchema;
+
+            if (tableName != null && editor != null)
+            {
+                StringWriter sql = new StringWriter();
+                SqlWriter.WriteUpdate(sql, GetTableOrViewByName(model, tableName));
+                editor.InsertText(sql.ToString());
+            }
+        }
+    }
+}
\ No newline at end of file
Added +41 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/LocateFkReferenceColumnCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/LocateFkReferenceColumnCommand.cs
new file mode 100644
index 0000000..ec425e4
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/LocateFkReferenceColumnCommand.cs
@@ -0,0 +1,41 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using MiniSqlQuery.Core.DbModel;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The locate fk reference column command.</summary>
+    public class LocateFkReferenceColumnCommand : GenerateStatementCommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="LocateFkReferenceColumnCommand"/> class.</summary>
+        public LocateFkReferenceColumnCommand()
+            : base("Jump to FK column reference...")
+        {
+        }
+
+        /// <summary>Gets a value indicating whether Enabled.</summary>
+        public override bool Enabled
+        {
+            get
+            {
+                DbModelColumn column = HostWindow.DatabaseInspector.RightClickedModelObject as DbModelColumn;
+                return column != null && column.ForeignKeyReference != null;
+            }
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            DbModelColumn column = HostWindow.DatabaseInspector.RightClickedModelObject as DbModelColumn;
+            if (column != null && column.ForeignKeyReference != null)
+            {
+                HostWindow.DatabaseInspector.NavigateTo(column.ForeignKeyReference.ReferenceColumn);
+            }
+        }
+    }
+}
\ No newline at end of file
Added +34 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/ShowDatabaseInspectorCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/ShowDatabaseInspectorCommand.cs
new file mode 100644
index 0000000..bdf1fd0
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/ShowDatabaseInspectorCommand.cs
@@ -0,0 +1,34 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.Commands;
+using WeifenLuo.WinFormsUI.Docking;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The show database inspector command.</summary>
+    public class ShowDatabaseInspectorCommand : CommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="ShowDatabaseInspectorCommand"/> class.</summary>
+        public ShowDatabaseInspectorCommand()
+            : base("Show Database Inspector")
+        {
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            DockContent databaseInspector = Services.Resolve<IDatabaseInspector>() as DockContent;
+            if (databaseInspector != null)
+            {
+                HostWindow.ShowDatabaseInspector(databaseInspector as IDatabaseInspector, DockState.DockLeft);
+                databaseInspector.Activate();
+            }
+        }
+    }
+}
\ No newline at end of file
Added +47 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/ShowFindObjectFormCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/ShowFindObjectFormCommand.cs
new file mode 100644
index 0000000..079ffe4
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/ShowFindObjectFormCommand.cs
@@ -0,0 +1,47 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System;
+using System.Linq;
+using System.Windows.Forms;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.Commands;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The show find object form command.</summary>
+    public class ShowFindObjectFormCommand : CommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="ShowFindObjectFormCommand"/> class.</summary>
+        public ShowFindObjectFormCommand()
+            : base("Find Object...")
+        {
+            ShortcutKeys = Keys.Alt | Keys.F;
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            using (var frm = Services.Resolve<FindObjectForm>())
+            {
+                frm.ShowDialog(HostWindow.Instance);
+
+                var selectedTableName = frm.SelectedObjectName;
+                if (frm.DialogResult == DialogResult.OK && !String.IsNullOrEmpty(selectedTableName))
+                {
+                    // Special case for handling schemas - We want the search without the [dbo].[foo] part 
+                    // but the FindTableOrView expects it....
+                    var parts = selectedTableName.Split('.').Select(s => "[" + s + "]").ToArray();
+                    var name = String.Join(".", parts);
+
+                    IDbModelNamedObject obj = HostWindow.DatabaseInspector.DbSchema.FindTableOrView(name);
+                    HostWindow.DatabaseInspector.NavigateTo(obj);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
Added +69 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/TruncateTableCommand.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/TruncateTableCommand.cs
new file mode 100644
index 0000000..373535d
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/Commands/TruncateTableCommand.cs
@@ -0,0 +1,69 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Windows.Forms;
+using MiniSqlQuery.Core;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector.Commands
+{
+    /// <summary>The truncate table command.</summary>
+    public class TruncateTableCommand : GenerateStatementCommandBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="TruncateTableCommand"/> class.</summary>
+        public TruncateTableCommand()
+            : base("Truncate Table")
+        {
+            SmallImage = ImageResource.table_delete;
+        }
+
+        /// <summary>Execute the command.</summary>
+        public override void Execute()
+        {
+            IHostWindow hostWindow = Services.HostWindow;
+            string tableName = hostWindow.DatabaseInspector.RightClickedTableName;
+
+            string caption = string.Format("Truncate '{0}' Table Confirmation", tableName);
+            string msg = string.Format("Delete all '{0}' data, are you sure?", tableName);
+            if (tableName != null && MessageBox.Show(msg, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
+            {
+                DbConnection dbConnection;
+                DbCommand cmd = null;
+
+                try
+                {
+                    hostWindow.SetPointerState(Cursors.WaitCursor);
+                    dbConnection = Settings.GetOpenConnection();
+                    cmd = dbConnection.CreateCommand();
+                    cmd.CommandText = "DELETE FROM " + tableName;
+                    cmd.CommandType = CommandType.Text;
+                    cmd.ExecuteNonQuery();
+                    Services.PostMessage(SystemMessage.TableTruncated, tableName);
+                }
+                catch (DbException dbExp)
+                {
+                    hostWindow.DisplaySimpleMessageBox(null, dbExp.Message, "Error");
+                }
+                catch (InvalidOperationException invalidExp)
+                {
+                    hostWindow.DisplaySimpleMessageBox(null, invalidExp.Message, "Error");
+                }
+                finally
+                {
+                    if (cmd != null)
+                    {
+                        cmd.Dispose();
+                    }
+
+                    hostWindow.SetPointerState(Cursors.Default);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
Added +553 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.cs
new file mode 100644
index 0000000..6a845c3
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.cs
@@ -0,0 +1,553 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System;
+using System.IO;
+using System.Media;
+using System.Windows.Forms;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.DbModel;
+using MiniSqlQuery.Properties;
+using WeifenLuo.WinFormsUI.Docking;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector
+{
+    /// <summary>The database inspector form.</summary>
+    public partial class DatabaseInspectorForm : DockContent, IDatabaseInspector
+    {
+        /// <summary>The root tag.</summary>
+        private static readonly object RootTag = new object();
+
+        /// <summary>The tables tag.</summary>
+        private static readonly object TablesTag = new object();
+
+        /// <summary>The views tag.</summary>
+        private static readonly object ViewsTag = new object();
+
+        /// <summary>The _host window.</summary>
+        private readonly IHostWindow _hostWindow;
+
+        /// <summary>The _services.</summary>
+        private readonly IApplicationServices _services;
+
+        /// <summary>The _meta data service.</summary>
+        private IDatabaseSchemaService _metaDataService;
+
+        /// <summary>The _model.</summary>
+        private DbModelInstance _model;
+
+        /// <summary>The _populated.</summary>
+        private bool _populated;
+
+        /// <summary>The _right clicked model object.</summary>
+        private IDbModelNamedObject _rightClickedModelObject;
+
+        /// <summary>The _right clicked node.</summary>
+        private TreeNode _rightClickedNode;
+
+        /// <summary>The _sql writer.</summary>
+        private ISqlWriter _sqlWriter;
+
+        /// <summary>The _tables node.</summary>
+        private TreeNode _tablesNode;
+
+        /// <summary>The _views node.</summary>
+        private TreeNode _viewsNode;
+
+        /// <summary>Initializes a new instance of the <see cref="DatabaseInspectorForm"/> class.</summary>
+        /// <param name="services">The services.</param>
+        /// <param name="hostWindow">The host window.</param>
+        public DatabaseInspectorForm(IApplicationServices services, IHostWindow hostWindow)
+        {
+            InitializeComponent();
+            BuildImageList();
+
+            DatabaseTreeView.Nodes.Clear();
+            TreeNode root = CreateRootNodes();
+            root.Nodes.Add("Loading problem - check connection details and reset...");
+            DatabaseTreeView.Nodes.Add(root);
+
+            _services = services;
+            _hostWindow = hostWindow;
+
+            _services.Settings.DatabaseConnectionReset += Settings_DatabaseConnectionReset;
+        }
+
+        /// <summary>Gets ColumnMenu.</summary>
+        public ContextMenuStrip ColumnMenu
+        {
+            get { return ColumnNameContextMenuStrip; }
+        }
+
+        /// <summary>Gets DbSchema.</summary>
+        public DbModelInstance DbSchema
+        {
+            get { return _model; }
+        }
+
+        /// <summary>Gets RightClickedModelObject.</summary>
+        public IDbModelNamedObject RightClickedModelObject
+        {
+            get { return _rightClickedModelObject; }
+        }
+
+        /// <summary>Gets RightClickedTableName.</summary>
+        public string RightClickedTableName
+        {
+            get
+            {
+                if (_rightClickedNode == null)
+                {
+                    return null;
+                }
+
+                return _rightClickedNode.Text;
+            }
+        }
+
+        /// <summary>Gets TableMenu.</summary>
+        public ContextMenuStrip TableMenu
+        {
+            get { return TableNodeContextMenuStrip; }
+        }
+
+        /// <summary>The load database details.</summary>
+        public void LoadDatabaseDetails()
+        {
+            ExecLoadDatabaseDetails();
+        }
+
+        /// <summary>The navigate to.</summary>
+        /// <param name="modelObject">The model object.</param>
+        public void NavigateTo(IDbModelNamedObject modelObject)
+        {
+            if (modelObject == null)
+            {
+                return;
+            }
+
+            // todo - ensure expanded
+
+            switch (modelObject.ObjectType)
+            {
+                case ObjectTypes.Table:
+                    foreach (TreeNode treeNode in _tablesNode.Nodes)
+                    {
+                        IDbModelNamedObject obj = treeNode.Tag as IDbModelNamedObject;
+                        if (obj != null && modelObject == obj)
+                        {
+                            SelectNode(treeNode);
+                        }
+                    }
+
+                    break;
+                case ObjectTypes.View:
+                    foreach (TreeNode treeNode in _viewsNode.Nodes)
+                    {
+                        IDbModelNamedObject obj = treeNode.Tag as IDbModelNamedObject;
+                        if (obj != null && modelObject == obj)
+                        {
+                            SelectNode(treeNode);
+                        }
+                    }
+
+                    break;
+                case ObjectTypes.Column:
+                    DbModelColumn modelColumn = modelObject as DbModelColumn;
+                    if (modelColumn != null)
+                    {
+                        foreach (TreeNode treeNode in _tablesNode.Nodes)
+                        {
+                            // only look in the tables nodw for FK refs
+                            DbModelTable modelTable = treeNode.Tag as DbModelTable;
+                            if (modelTable != null && modelTable == modelColumn.ParentTable)
+                            {
+                                // now find the column in the child nodes
+                                foreach (TreeNode columnNode in treeNode.Nodes)
+                                {
+                                    DbModelColumn modelReferingColumn = columnNode.Tag as DbModelColumn;
+                                    if (modelReferingColumn != null && modelReferingColumn == modelColumn)
+                                    {
+                                        SelectNode(columnNode);
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                    break;
+            }
+        }
+
+        /// <summary>The build image key.</summary>
+        /// <param name="column">The column.</param>
+        /// <returns>The build image key.</returns>
+        private string BuildImageKey(DbModelColumn column)
+        {
+            string imageKey = column.ObjectType;
+            if (column.IsRowVersion)
+            {
+                imageKey += "-RowVersion";
+            }
+            else
+            {
+                if (column.IsKey)
+                {
+                    imageKey += "-PK";
+                }
+
+                if (column.ForeignKeyReference != null)
+                {
+                    imageKey += "-FK";
+                }
+            }
+
+            return imageKey;
+        }
+
+        /// <summary>Builds the image list.
+        /// It's nicer to hadle image lists this way, easier to update etc</summary>
+        private void BuildImageList()
+        {
+            InspectorImageList.Images.Add("Table", ImageResource.table);
+            InspectorImageList.Images.Add("Database", ImageResource.database);
+            InspectorImageList.Images.Add("Column", ImageResource.column);
+            InspectorImageList.Images.Add("Tables", ImageResource.table_multiple);
+            InspectorImageList.Images.Add("Views", ImageResource.view_multiple);
+            InspectorImageList.Images.Add("View", ImageResource.view);
+            InspectorImageList.Images.Add("Column-PK", ImageResource.key);
+            InspectorImageList.Images.Add("Column-FK", ImageResource.key_go_disabled);
+            InspectorImageList.Images.Add("Column-PK-FK", ImageResource.key_go);
+            InspectorImageList.Images.Add("Column-RowVersion", ImageResource.column_row_version);
+        }
+
+        /// <summary>The build tool tip.</summary>
+        /// <param name="table">The table.</param>
+        /// <param name="column">The column.</param>
+        /// <returns>The build tool tip.</returns>
+        private string BuildToolTip(DbModelTable table, DbModelColumn column)
+        {
+            string friendlyColumnName = Utility.MakeSqlFriendly(column.Name);
+            string toolTip = table.FullName + "." + friendlyColumnName;
+            if (column.IsKey)
+            {
+                toolTip += "; Primary Key";
+            }
+
+            if (column.IsAutoIncrement)
+            {
+                toolTip += "; Auto*";
+            }
+
+            if (column.ForeignKeyReference != null)
+            {
+                toolTip += string.Format("; FK -> {0}.{1}", column.ForeignKeyReference.ReferenceTable.FullName, column.ForeignKeyReference.ReferenceColumn.Name);
+            }
+
+            if (column.IsReadOnly)
+            {
+                toolTip += "; Read Only";
+            }
+
+            return toolTip;
+        }
+
+        /// <summary>The build tree from db model.</summary>
+        /// <param name="connection">The connection.</param>
+        private void BuildTreeFromDbModel(string connection)
+        {
+            DatabaseTreeView.Nodes.Clear();
+            TreeNode root = CreateRootNodes();
+            root.ToolTipText = connection;
+
+            if (_model.Tables != null)
+            {
+                foreach (DbModelTable table in _model.Tables)
+                {
+                    CreateTreeNodes(table);
+                }
+            }
+
+            if (_model.Views != null)
+            {
+                foreach (DbModelView view in _model.Views)
+                {
+                    CreateTreeNodes(view);
+                }
+            }
+
+            DatabaseTreeView.Nodes.Add(root);
+        }
+
+        /// <summary>The create root nodes.</summary>
+        /// <returns></returns>
+        private TreeNode CreateRootNodes()
+        {
+            TreeNode root = new TreeNode(Resources.Database);
+            root.ImageKey = "Database";
+            root.SelectedImageKey = "Database";
+            root.ContextMenuStrip = InspectorContextMenuStrip;
+            root.Tag = RootTag;
+
+            _tablesNode = new TreeNode(Resources.Tables);
+            _tablesNode.ImageKey = "Tables";
+            _tablesNode.SelectedImageKey = "Tables";
+            _tablesNode.Tag = TablesTag;
+
+            _viewsNode = new TreeNode(Resources.Views);
+            _viewsNode.ImageKey = "Views";
+            _viewsNode.SelectedImageKey = "Views";
+            _viewsNode.Tag = ViewsTag;
+
+            root.Nodes.Add(_tablesNode);
+            root.Nodes.Add(_viewsNode);
+
+            return root;
+        }
+
+        /// <summary>The create tree nodes.</summary>
+        /// <param name="table">The table.</param>
+        private void CreateTreeNodes(DbModelTable table)
+        {
+            TreeNode tableNode = new TreeNode(table.FullName);
+            tableNode.Name = table.FullName;
+            tableNode.ImageKey = table.ObjectType;
+            tableNode.SelectedImageKey = table.ObjectType;
+            tableNode.ContextMenuStrip = TableNodeContextMenuStrip;
+            tableNode.Tag = table;
+
+            foreach (DbModelColumn column in table.Columns)
+            {
+                string friendlyColumnName = Utility.MakeSqlFriendly(column.Name);
+                TreeNode columnNode = new TreeNode(friendlyColumnName);
+                columnNode.Name = column.Name;
+                string imageKey = BuildImageKey(column);
+                columnNode.ImageKey = imageKey;
+                columnNode.SelectedImageKey = imageKey;
+                columnNode.ContextMenuStrip = ColumnNameContextMenuStrip;
+                columnNode.Tag = column;
+                columnNode.Text = GetSummary(column);
+                string toolTip = BuildToolTip(table, column);
+                columnNode.ToolTipText = toolTip;
+                tableNode.Nodes.Add(columnNode);
+            }
+
+            switch (table.ObjectType)
+            {
+                case ObjectTypes.Table:
+                    _tablesNode.Nodes.Add(tableNode);
+                    break;
+                case ObjectTypes.View:
+                    _viewsNode.Nodes.Add(tableNode);
+                    break;
+            }
+        }
+
+        /// <summary>The database inspector form_ form closing.</summary>
+        /// <param name="sender">The sender.</param>
+        /// <param name="e">The e.</param>
+        private void DatabaseInspectorForm_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            if (e.CloseReason == CloseReason.UserClosing)
+            {
+                Hide();
+                e.Cancel = true;
+            }
+        }
+
+
+        /// <summary>The database inspector form_ load.</summary>
+        /// <param name="sender">The sender.</param>
+        /// <param name="e">The e.</param>
+        private void DatabaseInspectorForm_Load(object sender, EventArgs e)
+        {
+        }
+
+        /// <summary>The database tree view_ before expand.</summary>
+        /// <param name="sender">The sender.</param>
+        /// <param name="e">The e.</param>
+        private void DatabaseTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e)
+        {
+            TreeNode node = e.Node;
+
+            if (node != null && node.Tag == RootTag && !_populated)
+            {
+                _populated = true;
+                bool ok = ExecLoadDatabaseDetails();
+
+                if (ok && DatabaseTreeView.Nodes.Count > 0)
+                {
+                    DatabaseTreeView.Nodes[0].Expand();
+                }
+                else
+                {
+                    e.Cancel = true;
+                }
+            }
+        }
+
+        /// <summary>The database tree view_ node mouse click.</summary>
+        /// <param name="sender">The sender.</param>
+        /// <param name="e">The e.</param>
+        private void DatabaseTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
+        {
+            TreeNode node = e.Node;
+            if (e.Button == MouseButtons.Right)
+            {
+                IDbModelNamedObject namedObject = node.Tag as IDbModelNamedObject;
+                _rightClickedModelObject = namedObject;
+
+                if (namedObject != null &&
+                    (namedObject.ObjectType == ObjectTypes.Table || namedObject.ObjectType == ObjectTypes.View))
+                {
+                    _rightClickedNode = node;
+                }
+                else
+                {
+                    _rightClickedNode = null;
+                }
+            }
+        }
+
+        /// <summary>The database tree view_ node mouse double click.</summary>
+        /// <param name="sender">The sender.</param>
+        /// <param name="e">The e.</param>
+        private void DatabaseTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
+        {
+            TreeNode node = e.Node;
+            if (e.Button == MouseButtons.Left)
+            {
+                IDbModelNamedObject namedObject = node.Tag as IDbModelNamedObject;
+                if (namedObject != null)
+                {
+                    SetText(namedObject.FullName);
+                }
+            }
+        }
+
+        /// <summary>The exec load database details.</summary>
+        /// <returns>The exec load database details.</returns>
+        private bool ExecLoadDatabaseDetails()
+        {
+            bool populate = false;
+            string connection = string.Empty;
+            bool success = false;
+
+            try
+            {
+                _hostWindow.SetPointerState(Cursors.WaitCursor);
+                if (_metaDataService == null)
+                {
+                    _metaDataService = DatabaseMetaDataService.Create(_services.Settings.ConnectionDefinition.ProviderName);
+                }
+
+                connection = _metaDataService.GetDescription();
+                populate = true;
+            }
+            catch (Exception exp)
+            {
+                string msg = string.Format(
+                    "{0}\r\n\r\nCheck the connection and select 'Refresh Database Connection'.",
+                    exp.Message);
+                _hostWindow.DisplaySimpleMessageBox(_hostWindow.Instance, msg, "DB Connection Error");
+                _hostWindow.SetStatus(this, exp.Message);
+            }
+            finally
+            {
+                _hostWindow.SetPointerState(Cursors.Default);
+            }
+
+            if (populate)
+            {
+                try
+                {
+                    _hostWindow.SetPointerState(Cursors.WaitCursor);
+                    _model = _metaDataService.GetDbObjectModel(_services.Settings.ConnectionDefinition.ConnectionString);
+                }
+                finally
+                {
+                    _hostWindow.SetPointerState(Cursors.Default);
+                }
+
+                BuildTreeFromDbModel(connection);
+                _hostWindow.SetStatus(this, string.Empty);
+                success = true;
+            }
+            else
+            {
+                _populated = false;
+                DatabaseTreeView.CollapseAll();
+            }
+
+            return success;
+        }
+
+        /// <summary>The get summary.</summary>
+        /// <param name="column">The column.</param>
+        /// <returns>The get summary.</returns>
+        private string GetSummary(DbModelColumn column)
+        {
+            StringWriter stringWriter = new StringWriter();
+            if (_sqlWriter == null)
+            {
+                _sqlWriter = _services.Resolve<ISqlWriter>();
+            }
+
+            _sqlWriter.WriteSummary(stringWriter, column);
+            return stringWriter.ToString();
+        }
+
+        /// <summary>The select node.</summary>
+        /// <param name="treeNode">The tree node.</param>
+        private void SelectNode(TreeNode treeNode)
+        {
+            if (treeNode.Parent != null)
+            {
+                treeNode.Parent.EnsureVisible();
+            }
+
+            treeNode.EnsureVisible();
+            DatabaseTreeView.SelectedNode = treeNode;
+            treeNode.Expand();
+            DatabaseTreeView.Focus();
+        }
+
+        /// <summary>The set text.</summary>
+        /// <param name="text">The text.</param>
+        private void SetText(string text)
+        {
+            IQueryEditor editor = _hostWindow.ActiveChildForm as IQueryEditor;
+
+            if (editor != null)
+            {
+                editor.InsertText(text);
+            }
+            else
+            {
+                SystemSounds.Beep.Play();
+            }
+        }
+
+        /// <summary>The settings_ database connection reset.</summary>
+        /// <param name="sender">The sender.</param>
+        /// <param name="e">The e.</param>
+        private void Settings_DatabaseConnectionReset(object sender, EventArgs e)
+        {
+            _metaDataService = null;
+            _sqlWriter = null;
+            ExecLoadDatabaseDetails();
+        }
+
+        /// <summary>The load tool strip menu item_ click.</summary>
+        /// <param name="sender">The sender.</param>
+        /// <param name="e">The e.</param>
+        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            LoadDatabaseDetails();
+        }
+    }
+}
\ No newline at end of file
Added +120 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.Designer.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.Designer.cs
new file mode 100644
index 0000000..6fa0653
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.Designer.cs
@@ -0,0 +1,120 @@
+namespace MiniSqlQuery.PlugIns.DatabaseInspector
+{
+	partial class DatabaseInspectorForm
+	{
+		/// <summary>
+		/// Required designer variable.
+		/// </summary>
+		private System.ComponentModel.IContainer components = null;
+
+		/// <summary>
+		/// Clean up any resources being used.
+		/// </summary>
+		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+		protected override void Dispose(bool disposing)
+		{
+			if (disposing && (components != null))
+			{
+				components.Dispose();
+			}
+			base.Dispose(disposing);
+		}
+
+		#region Windows Form Designer generated code
+
+		/// <summary>
+		/// Required method for Designer support - do not modify
+		/// the contents of this method with the code editor.
+		/// </summary>
+		private void InitializeComponent()
+		{
+            this.components = new System.ComponentModel.Container();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DatabaseInspectorForm));
+            this.InspectorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.InspectorImageList = new System.Windows.Forms.ImageList(this.components);
+            this.TableNodeContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.DatabaseTreeView = new System.Windows.Forms.TreeView();
+            this.ColumnNameContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.InspectorContextMenuStrip.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // InspectorContextMenuStrip
+            // 
+            this.InspectorContextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
+            this.InspectorContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.loadToolStripMenuItem});
+            this.InspectorContextMenuStrip.Name = "InspectorContextMenuStrip";
+            this.InspectorContextMenuStrip.Size = new System.Drawing.Size(196, 28);
+            // 
+            // loadToolStripMenuItem
+            // 
+            this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
+            this.loadToolStripMenuItem.Size = new System.Drawing.Size(195, 24);
+            this.loadToolStripMenuItem.Text = "&Load Meta-Data";
+            this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click);
+            // 
+            // InspectorImageList
+            // 
+            this.InspectorImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
+            this.InspectorImageList.ImageSize = new System.Drawing.Size(16, 16);
+            this.InspectorImageList.TransparentColor = System.Drawing.Color.Transparent;
+            // 
+            // TableNodeContextMenuStrip
+            // 
+            this.TableNodeContextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
+            this.TableNodeContextMenuStrip.Name = "TableNodeContextMenuStrip";
+            this.TableNodeContextMenuStrip.Size = new System.Drawing.Size(61, 4);
+            // 
+            // DatabaseTreeView
+            // 
+            this.DatabaseTreeView.ContextMenuStrip = this.InspectorContextMenuStrip;
+            this.DatabaseTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.DatabaseTreeView.ImageIndex = 0;
+            this.DatabaseTreeView.ImageList = this.InspectorImageList;
+            this.DatabaseTreeView.Location = new System.Drawing.Point(0, 0);
+            this.DatabaseTreeView.Name = "DatabaseTreeView";
+            this.DatabaseTreeView.SelectedImageIndex = 0;
+            this.DatabaseTreeView.ShowNodeToolTips = true;
+            this.DatabaseTreeView.Size = new System.Drawing.Size(478, 465);
+            this.DatabaseTreeView.TabIndex = 2;
+            this.DatabaseTreeView.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.DatabaseTreeView_BeforeExpand);
+            this.DatabaseTreeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.DatabaseTreeView_NodeMouseClick);
+            this.DatabaseTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.DatabaseTreeView_NodeMouseDoubleClick);
+            // 
+            // ColumnNameContextMenuStrip
+            // 
+            this.ColumnNameContextMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
+            this.ColumnNameContextMenuStrip.Name = "ColumnNameContextMenuStrip";
+            this.ColumnNameContextMenuStrip.Size = new System.Drawing.Size(61, 4);
+            // 
+            // DatabaseInspectorForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 17F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(478, 465);
+            this.Controls.Add(this.DatabaseTreeView);
+            this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+            this.Name = "DatabaseInspectorForm";
+            this.TabText = "DB Inspector";
+            this.Text = "Database Inspector";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DatabaseInspectorForm_FormClosing);
+            this.Load += new System.EventHandler(this.DatabaseInspectorForm_Load);
+            this.InspectorContextMenuStrip.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+		}
+
+		#endregion
+
+		private System.Windows.Forms.ContextMenuStrip InspectorContextMenuStrip;
+		private System.Windows.Forms.ContextMenuStrip TableNodeContextMenuStrip;
+		private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
+		private System.Windows.Forms.ImageList InspectorImageList;
+		private System.Windows.Forms.TreeView DatabaseTreeView;
+		private System.Windows.Forms.ContextMenuStrip ColumnNameContextMenuStrip;
+
+
+	}
+}
\ No newline at end of file
Added +161 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.resx b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.resx
new file mode 100644
index 0000000..6f7034b
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorForm.resx
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="InspectorContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>19, 20</value>
+  </metadata>
+  <metadata name="InspectorImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>610, 20</value>
+  </metadata>
+  <metadata name="TableNodeContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>210, 20</value>
+  </metadata>
+  <metadata name="ColumnNameContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>403, 20</value>
+  </metadata>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAA////AMOEUgC4uLgAdr58AN+qggDb29sAmpWRAOrHrQCLy5MA0ZdqALannAD27eYAysrKANK7
+        qQDnt5MA69O/AKKiogDw4tgArKysAMiNXwDXoXUA+/byAOTk5ACCxokA0dHRANvCrQDw8PAA2KyKAOrq
+        6gCysrIAmpqaAOrNtQDksowAzpJjAPr6+gDW1tYAp6enAMXFxQDj3tsA8+feAOnDpgDcpX0Ar6ScAOPH
+        sACTk5MA+PLtAH7DhADUm28A9PT0AJ6engDIilkAh8mOAKSgnAB6wYAA69C6AOKviADt7e0AtbW1APTq
+        4gDGhlUAxYpdANaecgDZpHoA8eXbAPfw6gDmtZAA6cmwAMuPXwD4+PgA9vb2APLy8gDi4uIA2dnZAKWl
+        pQDPz88Arq6uAMjIyADdqH4A4KyEAOvRvQD58+8A05luAKurqgDoyK4AxIZUAPv39ADJilsAxoxfANGW
+        aADdqYAA6s63AOrMswDozLUA6MesAPv7+wD5+fkAx4dWAPPz8wDx8fEA7+/vAOzs7ADX19cAqKioANXV
+        1QDQ0NAAsbGxAMvLywC0tLQAtra2ALe3twDGxsYAxopcAMuOXgD38esAzpNkANegdADao3oA69K+AOrP
+        ugDpya4A6MiwAPnz7gDy594A8eTbAKurqwDr0LsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAA+UlkicVdhAgICAgICAAAAFS5BDDsofBISEhISEj0AAD96dgEQAQEBCAEBARJYAABOUTd+
+        fn5+UCAgICAScAAABVFbAX4BAQF3FgEBEhQAABwnDhosXFxbXl55VBJVAAArUzUlC2IBAV4BAQFAPABr
+        HRtHZQ0HeENeQ3ldezMTI2ZIDUsBLQEBXgEBAXJETEUZZSZvAR8pKSkpKSlWc2pFaGRrawEyAQEBAQEB
+        VgpsRQZkaWkBEQk0GC82BFYwbUdJF0hNY0pWVlZWVlZWdANGMWBfRkZnD0IhOE9aKnUAJDlgXxtJfQAA
+        AAAAAAAAAAAAbjoeAAAAAAAAAAAAAMABAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAACAAAAAAAAAAAAA
+        AAAAAAAAAAAAAAAAAAAAAAAAgP8AAOP/AAA=
+</value>
+  </data>
+</root>
\ No newline at end of file
Added +53 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorLoader.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorLoader.cs
new file mode 100644
index 0000000..e3c5b0c
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/DatabaseInspectorLoader.cs
@@ -0,0 +1,53 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+#endregion
+
+using System.Windows.Forms;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.PlugIns.DatabaseInspector.Commands;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector
+{
+    /// <summary>The database inspector loader.</summary>
+    public class DatabaseInspectorLoader : PluginLoaderBase
+    {
+        /// <summary>Initializes a new instance of the <see cref="DatabaseInspectorLoader"/> class.</summary>
+        public DatabaseInspectorLoader()
+            : base(
+                "Database Inspector",
+                "A Mini SQL Query Plugin for displaying the database schema in a tree view",
+                20)
+        {
+        }
+
+        /// <summary>Iinitialize the plug in.</summary>
+        public override void InitializePlugIn()
+        {
+            Services.RegisterSingletonComponent<IDatabaseInspector, DatabaseInspectorForm>("DatabaseInspector");
+            Services.RegisterComponent<FindObjectForm>("FindObjectForm");
+
+            IHostWindow hostWindow = Services.HostWindow;
+            hostWindow.AddPluginCommand<ShowDatabaseInspectorCommand>();
+            CommandManager.GetCommandInstance<ShowDatabaseInspectorCommand>().Execute();
+
+            ToolStripMenuItem editMenu = hostWindow.GetMenuItem("edit");
+            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem<ShowFindObjectFormCommand>());
+
+            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<GenerateSelectStatementCommand>());
+            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<GenerateSelectCountStatementCommand>());
+            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<GenerateInsertStatementCommand>());
+            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<GenerateUpdateStatementCommand>());
+            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<GenerateDeleteStatementCommand>());
+            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<CopyTableNameCommand>());
+            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<TruncateTableCommand>());
+
+            hostWindow.DatabaseInspector.ColumnMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<LocateFkReferenceColumnCommand>());
+
+            // todo: bug - the opening event is not firing....
+            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(hostWindow.DatabaseInspector.ColumnMenu);
+        }
+    }
+}
\ No newline at end of file
Added +203 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.cs
new file mode 100644
index 0000000..1529d11
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.cs
@@ -0,0 +1,203 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Windows.Forms;
+using MiniSqlQuery.Core;
+using MiniSqlQuery.Core.DbModel;
+
+namespace MiniSqlQuery.PlugIns.DatabaseInspector
+{
+    /// <summary>The find object form.</summary>
+    public partial class FindObjectForm : Form
+    {
+        /// <summary>The _database inspector.</summary>
+        private readonly IDatabaseInspector _databaseInspector;
+
+        private readonly List<string> _items = new List<string>();
+        private string _selectedItem;
+
+        /// <summary>Initializes a new instance of the <see cref="FindObjectForm"/> class.</summary>
+        /// <param name="databaseInspector">The database inspector.</param>
+        public FindObjectForm(IDatabaseInspector databaseInspector)
+        {
+            _databaseInspector = databaseInspector;
+            InitializeComponent();
+        }
+
+        /// <summary>Gets the Selected Table Name.</summary>
+        [Obsolete]
+        public string SelectedTableName
+        {
+            get { return _selectedItem; }
+        }
+
+        /// <summary>Gets the Selected Object Name.</summary>
+        public string SelectedObjectName
+        {
+            get { return _selectedItem; }
+        }
+
+        /// <summary>Check the keys, escape to exit, enter to select. If up or down are pressed move the list item.</summary>
+        /// <param name="msg">The windows message.</param>
+        /// <param name="keyData">The key data.</param>
+        /// <returns>The process command key result.</returns>
+        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
+        {
+            switch (keyData)
+            {
+                case Keys.Escape:
+                    DialogResult = DialogResult.Cancel;
+                    Close();
+                    break;
+
+                case Keys.Enter:
+                    Done();
+                    break;
+
+                case Keys.Up:
+                    MoveSelectionUp();
+                    return true;
+
+                case Keys.Down:
+                    MoveSelectionDown();
+                    return true;
+            }
+
+            return base.ProcessCmdKey(ref msg, keyData);
+        }
+
+        private void FindObjectForm_Load(object sender, EventArgs e)
+        {
+        }
+
+        private void FindObjectForm_Shown(object sender, EventArgs e)
+        {
+            _items.Clear();
+
+            try
+            {
+                UseWaitCursor = true;
+
+                if (_databaseInspector.DbSchema == null)
+                {
+                    _databaseInspector.LoadDatabaseDetails();
+
+                    // And if it is still null (e.g. connection error) then bail out:
+                    if (_databaseInspector.DbSchema == null)
+                    {
+                        return;
+                    }
+                }
+
+                foreach (DbModelTable table in _databaseInspector.DbSchema.Tables)
+                {
+                    var name = table.Schema;
+                    if (!String.IsNullOrEmpty(name))
+                    {
+                        name += ".";
+                    }
+                    name += table.Name;
+
+                    _items.Add(name);
+                }
+
+                foreach (DbModelView view in _databaseInspector.DbSchema.Views)
+                {
+                    _items.Add(view.FullName);
+                }
+            }
+            finally
+            {
+                UseWaitCursor = false;
+            }
+
+            lstItems.DataSource = _items;
+            txtSearchPattern.Focus();
+        }
+
+        private void lstItems_DoubleClick(object sender, EventArgs e)
+        {
+            Done();
+        }
+
+        private void txtSearchPattern_TextChanged(object sender, EventArgs e)
+        {
+            if (_items != null)
+            {
+                var searchValue = txtSearchPattern.Text.ToLowerInvariant();
+                var dataSource = _items.Where(objectName =>
+                {
+                    objectName = objectName ?? String.Empty;
+                    objectName = objectName.ToLowerInvariant();
+                    return objectName.Contains(searchValue);
+                }).ToList();
+                Debug.WriteLine(string.Format("search '{0}' yields {1}...", searchValue, dataSource.Count));
+
+                lstItems.DataSource = dataSource;
+            }
+            else
+            {
+                lstItems.DataSource = null;
+            }
+
+            SetSelectedName();
+        }
+
+        /// <summary>
+        /// If there is a valid selection remember it.
+        /// </summary>
+        private void SetSelectedName()
+        {
+            _selectedItem = String.Empty;
+
+            if (lstItems.SelectedItem != null)
+            {
+                _selectedItem = lstItems.SelectedItem.ToString();
+            }
+        }
+
+        /// <summary>
+        /// Move the list selection up one if we can.
+        /// </summary>
+        private void MoveSelectionUp()
+        {
+            if (lstItems.SelectedIndex < 1)
+            {
+                return;
+            }
+            lstItems.SelectedIndex--;
+        }
+
+        /// <summary>
+        /// Move the list selection down one if we can.
+        /// </summary>
+        private void MoveSelectionDown()
+        {
+            var maxIndex = lstItems.Items.Count - 1;
+            if (lstItems.SelectedIndex >= maxIndex)
+            {
+                return;
+            }
+            lstItems.SelectedIndex++;
+        }
+
+        /// <summary>
+        /// Set the selected item and close the form.
+        /// </summary>
+        private void Done()
+        {
+            SetSelectedName();
+            DialogResult = DialogResult.OK;
+            Close();
+        }
+    }
+}
\ No newline at end of file
Added +82 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.Designer.cs b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.Designer.cs
new file mode 100644
index 0000000..bc01518
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.Designer.cs
@@ -0,0 +1,82 @@
+namespace MiniSqlQuery.PlugIns.DatabaseInspector
+{
+	partial class FindObjectForm
+	{
+		/// <summary>
+		/// Required designer variable.
+		/// </summary>
+		private System.ComponentModel.IContainer components = null;
+
+		/// <summary>
+		/// Clean up any resources being used.
+		/// </summary>
+		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+		protected override void Dispose(bool disposing)
+		{
+			if (disposing && (components != null))
+			{
+				components.Dispose();
+			}
+			base.Dispose(disposing);
+		}
+
+		#region Windows Form Designer generated code
+
+		/// <summary>
+		/// Required method for Designer support - do not modify
+		/// the contents of this method with the code editor.
+		/// </summary>
+		private void InitializeComponent()
+		{
+            this.txtSearchPattern = new System.Windows.Forms.TextBox();
+            this.lstItems = new System.Windows.Forms.ListBox();
+            this.SuspendLayout();
+            // 
+            // txtSearchPattern
+            // 
+            this.txtSearchPattern.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.txtSearchPattern.Location = new System.Drawing.Point(12, 12);
+            this.txtSearchPattern.Name = "txtSearchPattern";
+            this.txtSearchPattern.Size = new System.Drawing.Size(553, 22);
+            this.txtSearchPattern.TabIndex = 2;
+            this.txtSearchPattern.TextChanged += new System.EventHandler(this.txtSearchPattern_TextChanged);
+            // 
+            // lstItems
+            // 
+            this.lstItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.lstItems.FormattingEnabled = true;
+            this.lstItems.ItemHeight = 16;
+            this.lstItems.Location = new System.Drawing.Point(12, 38);
+            this.lstItems.Name = "lstItems";
+            this.lstItems.Size = new System.Drawing.Size(553, 244);
+            this.lstItems.TabIndex = 3;
+            this.lstItems.DoubleClick += new System.EventHandler(this.lstItems_DoubleClick);
+            // 
+            // FindObjectForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(577, 295);
+            this.Controls.Add(this.lstItems);
+            this.Controls.Add(this.txtSearchPattern);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(4);
+            this.Name = "FindObjectForm";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.Text = "Find Object";
+            this.Load += new System.EventHandler(this.FindObjectForm_Load);
+            this.Shown += new System.EventHandler(this.FindObjectForm_Shown);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+		}
+
+		#endregion
+
+        private System.Windows.Forms.TextBox txtSearchPattern;
+        private System.Windows.Forms.ListBox lstItems;
+	}
+}
\ No newline at end of file
Added +120 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.resx b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.resx
new file mode 100644
index 0000000..19dc0dd
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/PlugIns/DatabaseInspector/FindObjectForm.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file