8 changed files with 411 additions and 3 deletions
@ -0,0 +1,136 @@
@@ -0,0 +1,136 @@
|
||||
/* |
||||
* User: dickon |
||||
* Date: 21/11/2006 |
||||
* Time: 19:12 |
||||
* |
||||
*/ |
||||
namespace SharpDbTools.Forms |
||||
{ |
||||
partial class SQLTool : System.Windows.Forms.UserControl |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the control.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.sqlToolTabControl = new System.Windows.Forms.TabControl(); |
||||
this.editorTab = new System.Windows.Forms.TabPage(); |
||||
this.resultTab = new System.Windows.Forms.TabPage(); |
||||
this.messageTab = new System.Windows.Forms.TabPage(); |
||||
this.resultDataGridView = new System.Windows.Forms.DataGridView(); |
||||
this.messageTextBox = new System.Windows.Forms.TextBox(); |
||||
this.sqlToolTabControl.SuspendLayout(); |
||||
this.resultTab.SuspendLayout(); |
||||
this.messageTab.SuspendLayout(); |
||||
((System.ComponentModel.ISupportInitialize)(this.resultDataGridView)).BeginInit(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// sqlToolTabControl
|
||||
//
|
||||
this.sqlToolTabControl.Controls.Add(this.editorTab); |
||||
this.sqlToolTabControl.Controls.Add(this.resultTab); |
||||
this.sqlToolTabControl.Controls.Add(this.messageTab); |
||||
this.sqlToolTabControl.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.sqlToolTabControl.Location = new System.Drawing.Point(0, 0); |
||||
this.sqlToolTabControl.Name = "sqlToolTabControl"; |
||||
this.sqlToolTabControl.SelectedIndex = 0; |
||||
this.sqlToolTabControl.Size = new System.Drawing.Size(885, 522); |
||||
this.sqlToolTabControl.TabIndex = 0; |
||||
this.sqlToolTabControl.UseWaitCursor = true; |
||||
//
|
||||
// editorTab
|
||||
//
|
||||
this.editorTab.Location = new System.Drawing.Point(4, 24); |
||||
this.editorTab.Name = "editorTab"; |
||||
this.editorTab.Padding = new System.Windows.Forms.Padding(3); |
||||
this.editorTab.Size = new System.Drawing.Size(877, 494); |
||||
this.editorTab.TabIndex = 0; |
||||
this.editorTab.Text = "Editor"; |
||||
this.editorTab.UseVisualStyleBackColor = true; |
||||
this.editorTab.UseWaitCursor = true; |
||||
//
|
||||
// resultTab
|
||||
//
|
||||
this.resultTab.Controls.Add(this.resultDataGridView); |
||||
this.resultTab.Location = new System.Drawing.Point(4, 24); |
||||
this.resultTab.Name = "resultTab"; |
||||
this.resultTab.Padding = new System.Windows.Forms.Padding(3); |
||||
this.resultTab.Size = new System.Drawing.Size(877, 494); |
||||
this.resultTab.TabIndex = 1; |
||||
this.resultTab.Text = "Results"; |
||||
this.resultTab.UseVisualStyleBackColor = true; |
||||
this.resultTab.UseWaitCursor = true; |
||||
//
|
||||
// messageTab
|
||||
//
|
||||
this.messageTab.Controls.Add(this.messageTextBox); |
||||
this.messageTab.Location = new System.Drawing.Point(4, 24); |
||||
this.messageTab.Name = "messageTab"; |
||||
this.messageTab.Padding = new System.Windows.Forms.Padding(3); |
||||
this.messageTab.Size = new System.Drawing.Size(877, 494); |
||||
this.messageTab.TabIndex = 2; |
||||
this.messageTab.Text = "Messages"; |
||||
this.messageTab.UseVisualStyleBackColor = true; |
||||
this.messageTab.UseWaitCursor = true; |
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
this.resultDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
||||
this.resultDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.resultDataGridView.Location = new System.Drawing.Point(3, 3); |
||||
this.resultDataGridView.Name = "resultDataGridView"; |
||||
this.resultDataGridView.Size = new System.Drawing.Size(871, 488); |
||||
this.resultDataGridView.TabIndex = 0; |
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.messageTextBox.Dock = System.Windows.Forms.DockStyle.Fill; |
||||
this.messageTextBox.Location = new System.Drawing.Point(3, 3); |
||||
this.messageTextBox.Multiline = true; |
||||
this.messageTextBox.Name = "messages"; |
||||
this.messageTextBox.Size = new System.Drawing.Size(871, 488); |
||||
this.messageTextBox.TabIndex = 0; |
||||
//
|
||||
// SQLTool
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.Controls.Add(this.sqlToolTabControl); |
||||
this.Name = "SQLTool"; |
||||
this.Size = new System.Drawing.Size(885, 522); |
||||
this.sqlToolTabControl.ResumeLayout(false); |
||||
this.resultTab.ResumeLayout(false); |
||||
this.messageTab.ResumeLayout(false); |
||||
this.messageTab.PerformLayout(); |
||||
((System.ComponentModel.ISupportInitialize)(this.resultDataGridView)).EndInit(); |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.TextBox messageTextBox; |
||||
private System.Windows.Forms.DataGridView resultDataGridView; |
||||
private System.Windows.Forms.TabControl sqlToolTabControl; |
||||
private System.Windows.Forms.TabPage messageTab; |
||||
private System.Windows.Forms.TabPage resultTab; |
||||
private System.Windows.Forms.TabPage editorTab; |
||||
} |
||||
} |
||||
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
/* |
||||
* User: dickon |
||||
* Date: 21/11/2006 |
||||
* Time: 19:12 |
||||
* |
||||
*/ |
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.TextEditor; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace SharpDbTools.Forms |
||||
{ |
||||
/// <summary>
|
||||
/// Description of SQLEditorQueryTool.
|
||||
/// </summary>
|
||||
public partial class SQLTool |
||||
{ |
||||
private string logicalConnectionName = null; |
||||
private TextEditorControl sqlEditorControl = null; |
||||
|
||||
public SQLTool(string logicalConnectionName) |
||||
{ |
||||
this.logicalConnectionName = logicalConnectionName; |
||||
|
||||
//
|
||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent(); |
||||
|
||||
// add sqlEditor to the editor panel
|
||||
|
||||
sqlEditorControl = new TextEditorControl(); |
||||
sqlEditorControl.Dock = DockStyle.Fill; |
||||
sqlEditorControl.SetHighlighting("SQL"); |
||||
this.editorTab.Controls.Add(sqlEditorControl); |
||||
|
||||
// add context behaviour to the editor control
|
||||
|
||||
ContextMenuStrip contextMenu = new ContextMenuStrip(); |
||||
|
||||
ToolStripMenuItem executeSQLMenuItem = new ToolStripMenuItem("Execute SQL"); |
||||
executeSQLMenuItem.Click += new EventHandler(ExecuteSQLClickHandler); |
||||
|
||||
contextMenu.Items.AddRange(new ToolStripMenuItem[] |
||||
{ |
||||
executeSQLMenuItem |
||||
}); |
||||
sqlEditorControl.ContextMenuStrip = contextMenu; |
||||
} |
||||
|
||||
private void ExecuteSQLClickHandler(object sender, EventArgs args) |
||||
{ |
||||
// 1. get a connection from the the logical connection name
|
||||
// 2. attempt to execute any SQL currently contained in the editor
|
||||
// 3. display either a result set in the result DataGridView, or
|
||||
// messages in the messages textbox in the message tab.
|
||||
LoggingService.Debug(this.GetType().Name + "-> ExecuteSQLClickHandler"); |
||||
|
||||
// TODO: hand off the execution of the query to a background thread...
|
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,120 @@
@@ -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> |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
/* |
||||
* User: dickon |
||||
* Date: 21/11/2006 |
||||
* Time: 22:46 |
||||
* |
||||
*/ |
||||
|
||||
using System; |
||||
using System.Data; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace SharpDbTools.Forms |
||||
{ |
||||
/// <summary>
|
||||
/// Description of SQLEditorQueryToolViewContent.
|
||||
/// </summary>
|
||||
public class SQLToolViewContent : AbstractViewContent |
||||
{ |
||||
string logicalConnectionName; |
||||
SQLTool sqlTool; |
||||
|
||||
public SQLToolViewContent(string logicalConnectionName): |
||||
base("SQL Tool: " + logicalConnectionName) |
||||
{ |
||||
this.logicalConnectionName = logicalConnectionName; |
||||
sqlTool = new SQLTool(this.logicalConnectionName); |
||||
} |
||||
|
||||
public override System.Windows.Forms.Control Control { |
||||
get { |
||||
return this.sqlTool; |
||||
} |
||||
} |
||||
|
||||
public override bool IsReadOnly { |
||||
get { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public override bool IsViewOnly { |
||||
get { |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue