diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.ReportDesigner.addin b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.ReportDesigner.addin
index 6d8c5a7a10..78ba2c16e2 100644
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.ReportDesigner.addin
+++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.ReportDesigner.addin
@@ -199,199 +199,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.Reports.Addin.csproj b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.Reports.Addin.csproj
index 2ff16a8244..cd87475ce5 100644
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.Reports.Addin.csproj
+++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.Reports.Addin.csproj
@@ -178,7 +178,6 @@
-
UserControl
@@ -236,33 +235,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Component
-
-
- Form
-
-
-
-
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportStructure.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportStructure.cs
index 279b2c8970..0fd453e5ed 100644
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportStructure.cs
+++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/ReportStructure.cs
@@ -10,7 +10,7 @@ using System.Data;
using System.Drawing;
using ICSharpCode.Reports.Core;
-using SharpQuery.SchemaClass;
+
///
/// This class creates settings for a report
///
@@ -112,10 +112,6 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
}
}
- ///
- /// This Property is only usefull for ResultPanel
- ///
- public SharpQueryProcedure SharpQueryProcedure {get;set;}
#endregion
@@ -168,9 +164,9 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
}
- if (this.SharpQueryProcedure != null) {
- this.SharpQueryProcedure = null;
- }
+// if (this.SharpQueryProcedure != null) {
+// this.SharpQueryProcedure = null;
+// }
}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/SqlParameterConverter.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/SqlParameterConverter.cs
deleted file mode 100644
index 791d153413..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/SqlParameterConverter.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Erstellt mit SharpDevelop.
- * Benutzer: Peter Forstmeier
- * Datum: 29.08.2008
- * Zeit: 19:44
- *
- * Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
- */
-using System;
-using System.ComponentModel;
-using ICSharpCode.Reports.Core;
-using SharpQuery.Collections;
-using SharpQuery.SchemaClass;
-
-namespace ICSharpCode.Reports.Addin.ReportWizard
-{
- ///
- /// Description of SqlParameterConverter.
- ///
- public class SqlParameterConverter:TypeConverter
- {
- public SqlParameterConverter()
- {
- }
- public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
- {
- if (sourceType == typeof(SharpQuerySchemaClassCollection)) {
- return true;
- }
- return base.CanConvertFrom(context, sourceType);
- }
-
- public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
- {
- return base.ConvertFrom(context, culture, value);
- }
-
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(ParameterCollection)) {
- return true;
- }
- return base.CanConvertFrom(context, destinationType);
- }
-
-
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- SharpQuerySchemaClassCollection tmp= value as SharpQuerySchemaClassCollection;
-
- if (destinationType == typeof (ParameterCollection)) {
- ParameterCollection a = new ParameterCollection();
- foreach (SharpQueryParameter par in tmp){
- SqlParameter reportPar = new SqlParameter (par.Name,
- par.DataType,
- String.Empty,
- par.Type);
- reportPar.ParameterValue = par.Value.ToString();
- a.Add(reportPar);
- }
- return a;
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
-
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/LayoutPanel.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/LayoutPanel.cs
index 504a04af38..7f0542e9dc 100644
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/LayoutPanel.cs
+++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/LayoutPanel.cs
@@ -18,8 +18,7 @@ using ICSharpCode.Core;
using ICSharpCode.Reports.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
-using SharpQuery.Collections;
-using SharpQuery.SchemaClass;
+
namespace ICSharpCode.Reports.Addin.ReportWizard
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/PullModelPanel.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/PullModelPanel.cs
index 8fa8525e83..6323e08ac8 100644
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/PullModelPanel.cs
+++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/PullModelPanel.cs
@@ -16,8 +16,6 @@ using ICSharpCode.Core;
using ICSharpCode.Data.Core.Interfaces;
using ICSharpCode.Data.Core.UI.UserControls;
using ICSharpCode.SharpDevelop;
-using SharpQuery.Gui.TreeView;
-using SharpQuery.SchemaClass;
namespace ICSharpCode.Reports.Addin.ReportWizard
@@ -100,11 +98,10 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
}
if (message == DialogMessage.Next) {
- if (currentNode is SharpQueryNodeProcedure) {
- commandType = CommandType.StoredProcedure;
- } else {
- commandType = CommandType.Text;
- }
+
+
+ commandType = CommandType.Text;
+
customizer.Set("SqlString", this.txtSqlString.Text.Trim());
reportStructure.CommandType = commandType;
reportStructure.SqlString = this.txtSqlString.Text.Trim();
@@ -215,7 +212,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
IProcedure procedure = draggedObject as IProcedure;
this.txtSqlString.Text = "EXECUTE " + procedure.Name;
- reportStructure.SharpQueryProcedure = new SharpQueryProcedure(new SharpQuery.Connection.OLEDBConnectionWrapper(this.connectionString), procedure.Parent.Name, procedure.SchemaName, string.Empty, procedure.Name);
+// reportStructure.SharpQueryProcedure = new SharpQueryProcedure(new SharpQuery.Connection.OLEDBConnectionWrapper(this.connectionString), procedure.Parent.Name, procedure.SchemaName, string.Empty, procedure.Name);
break;
case NodeType.ViewImage:
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/ResultPanel.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/ResultPanel.cs
index 9f7a5367d2..aa4400a44d 100644
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/ResultPanel.cs
+++ b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/ResultPanel.cs
@@ -17,8 +17,7 @@ using ICSharpCode.Core;
using ICSharpCode.Reports.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
-using SharpQuery.Collections;
-using SharpQuery.SchemaClass;
+
namespace ICSharpCode.Reports.Addin.ReportWizard
{
@@ -70,7 +69,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
this.txtSqlString.Text = model.ReportSettings.CommandText;
if (model.ReportSettings.CommandType == CommandType.StoredProcedure){
-
+ /*
if (reportStructure.SharpQueryProcedure == null) {
throw new IllegalQueryException();
}
@@ -83,6 +82,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
}else {
dataSet = ExecuteStoredProc ();
}
+ */
}
// from here we create from an SqlString like "Select...."
@@ -137,7 +137,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
}
}
-
+ /*
private DataSet ExecuteStoredProc (SharpQueryProcedure procedure)
{
@@ -183,7 +183,7 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
return null;
}
-
+*/
private DataSet BuildFromSqlString ()
{
DbDataAdapter adapter = null;
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/AbstractSharpQueryCommand.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/AbstractSharpQueryCommand.cs
deleted file mode 100644
index cb150026d0..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/AbstractSharpQueryCommand.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using ICSharpCode.Core;
-using SharpQuery.Gui.TreeView;
-
-namespace SharpQuery.Commands
-{
- ///
- /// Base class of all commands of SharpQuery Addin
- ///
- public abstract class AbstractSharpQueryCommand : AbstractMenuCommand
- {
- protected ISharpQueryNode sharpQueryNode = null;
-
- ///
- /// get the selected SharpQuery node
- /// and Enabled or disabled the command
- /// If the selected node is null or this is not a SharpQuery node , return false (disable the menu)
- ///
- public override bool IsEnabled
- {
- get
- {
- SharpQueryTree sharpQueryTree;
- sharpQueryTree = this.Owner as SharpQueryTree;
-
- if ((sharpQueryTree != null) && (sharpQueryTree.SelectedNode != null))
- {
- this.sharpQueryNode = sharpQueryTree.SelectedNode as ISharpQueryNode;
- }
- else
- {
- this.sharpQueryNode = null;
- }
-
- return (this.sharpQueryNode != null);
- }
- set { }
-
- }
-
- ///
- /// Create a new SharpQueryCommand
- ///
- public AbstractSharpQueryCommand()
- : base()
- {
- }
-
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/AbstractSharpQuerySchemaClass.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/AbstractSharpQuerySchemaClass.cs
deleted file mode 100644
index 31e98a440d..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/AbstractSharpQuerySchemaClass.cs
+++ /dev/null
@@ -1,284 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Windows.Forms;
-using SharpQuery.Collections;
-using SharpQuery.Connection;
-
-namespace SharpQuery.SchemaClass
-{
- public abstract class AbstractSharpQuerySchemaClass : ISchemaClass
- {
- protected string pCatalogName = null;
- protected string pSchemaName = null;
- protected string pOwnerName = null;
- protected string pName = null;
-
- protected IConnection pDataConnection = null;
-
- ///
- /// check if there are white spaces into the string.
- /// if yes, then add "[" at the begin and "]" at the end.
- ///
- internal static string CheckWhiteSpace(string str)
- {
- string returnStr = str;
-
- if (returnStr.IndexOf(" ") > -1)
- {
- if (returnStr.StartsWith("[") == false)
- {
- returnStr = "[" + returnStr;
- }
- if (returnStr.EndsWith("]") == false)
- {
- returnStr = returnStr + "]";
- }
- }
-
- return returnStr;
- }
-
- ///remove "[" at the begin and at the end of the str
- internal static string RemoveBracket(string str)
- {
- string returnStr = str;
- if (returnStr.StartsWith("[") == true)
- {
- returnStr = returnStr.Remove(0, 1);
- }
- if (returnStr.EndsWith("]") == true)
- {
- returnStr = returnStr.Remove(returnStr.Length - 1, 1);
- }
- return returnStr;
- }
-
-
- ///
- /// those, are list of the childs schema.
- /// i am using a dictionnary () because is more simplest to write
- /// Entities["PROCEDURES"] than Entities[0].
- ///
- protected SharpQueryListDictionary pEntities = null;
-
- public string CatalogName
- {
- get
- {
- return CheckWhiteSpace(this.pCatalogName);
- }
- }
-
- public string SchemaName
- {
- get
- {
- return CheckWhiteSpace(this.pSchemaName);
- }
- }
-
- public string OwnerName
- {
- get
- {
- return CheckWhiteSpace(this.pOwnerName);
- }
- }
-
- public string Name
- {
- get
- {
- return CheckWhiteSpace(this.pName);
- }
- }
-
- public string InternalName
- {
- get
- {
- return RemoveBracket(this.Name);
- }
- }
-
- public virtual string NormalizedName
- {
- get
- {
- return CheckWhiteSpace(Name);
- }
- }
-
- ///
- /// those, are list of the childs schema.
- /// i am using a dictionnary () because is more simplest to write
- /// Entities["PROCEDURES"] than Entities[0].
- ///
- public SharpQueryListDictionary Entities
- {
- get
- {
- return pEntities;
- }
- }
-
- public IConnection Connection
- {
- get
- {
- return this.pDataConnection;
- }
- }
-
- /// return a DataObject
- ///
- public virtual DataObject DragObject
- {
- get
- {
- return null;
- }
- }
-
- //create the entities list
- protected virtual void CreateEntitiesList()
- {
- if (this.pEntities == null)
- {
- this.pEntities = new SharpQueryListDictionary();
- }
- }
-
- ///
- /// construtor
- ///
- ///
- /// parameters
- ///
- ///
- /// -
- ///
connection
- /// connection object from wich this schema is extracted
- ///
- /// -
- ///
catalogName
- /// this is the catalog of this schema entity
- ///
- /// -
- ///
schemaName
- /// this is the schema of this schema entity
- ///
- /// -
- ///
ownerName
- /// this is the owner name of this schema entity
- ///
- /// -
- ///
name
- /// this is the name of this schema entity
- ///
- ///
- ///
- public AbstractSharpQuerySchemaClass(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base()
- {
- this.pCatalogName = catalogName;
- this.pSchemaName = schemaName;
- this.pOwnerName = ownerName;
- this.pName = name;
- this.pDataConnection = connection;
-
- this.CreateEntitiesList();
- }
-
- ///
- /// called by Refresh just after the Clear and before childs'refresh.
- /// In this, you could change the Entities dicntionnary.
- ///
- protected abstract void OnRefresh();
-
- public void Refresh()
- {
- this.Clear();
- this.CreateEntitiesList();
-
- if (this.Connection.IsOpen == true)
- {
- this.OnRefresh();
- }
- }
-
- public void Clear()
- {
- if (this.pEntities != null)
- {
- this.pEntities.Clear();
- }
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public abstract object Execute(int rows, SharpQuerySchemaClassCollection parameters);
-
- /// if CatalogName is null or empty
- /// enumerate all catalogs from the database.
- /// Else enumerate the current catalog's properties.
- ///
- public virtual SharpQuerySchemaClassCollection GetSchemaCatalogs()
- {
- return this.pDataConnection.GetSchemaCatalogs(this);
- }
-
- /// if CatalogName is null or empty
- /// enumerate all shcema from the database.
- /// Else enumerate schemas from the current catalog.
- ///
- public virtual SharpQuerySchemaClassCollection GetSchemaSchemas()
- {
- return this.pDataConnection.GetSchemaSchemas(this);
- }
-
- /// Enumerate the CatalogName.SchemaName's tables
- ///
- public virtual SharpQuerySchemaClassCollection GetSchemaTables()
- {
- return this.pDataConnection.GetSchemaTables(this);
- }
-
- /// Enumerate the CatalogName.SchemaName's views
- ///
- public virtual SharpQuerySchemaClassCollection GetSchemaViews()
- {
- return this.pDataConnection.GetSchemaViews(this);
- }
-
- /// Enumerate the CatalogName.SchemaName's procedures
- ///
- public virtual SharpQuerySchemaClassCollection GetSchemaProcedures()
- {
- return this.pDataConnection.GetSchemaProcedures(this);
- }
-
- public virtual SharpQuerySchemaClassCollection GetSchemaColumns()
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- return list;
- }
-
- public virtual SharpQuerySchemaClassCollection GetSchemaParameters()
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- return list;
- }
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Collections.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Collections.cs
deleted file mode 100644
index 38d6d5a1f8..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Collections.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Collections.Generic;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Collections
-{
- [Serializable()]
- public class SharpQuerySchemaClassCollection : List
- {
- }
-
- [Serializable()]
- public class SharpQueryListDictionary : Dictionary
- {
- }
-
- [Serializable()]
- public class SharpQueryParameterCollection : List{
-
- public SharpQueryParameterCollection () {
- }
- ///
- ///
- /// Initializes a new instance of based on another .
- ///
- ///
- ///
- /// A from which the contents are copied
- ///
- public SharpQueryParameterCollection(SharpQueryParameterCollection value) {
- this.AddRange(value);
- }
-
- ///
- ///
- /// Initializes a new instance of containing any array of objects.
- ///
- ///
- ///
- /// A array of objects with which to intialize the collection
- ///
- public SharpQueryParameterCollection(SharpQueryParameter[] value) {
- this.AddRange(value);
- }
-
-
- public SharpQuerySchemaClassCollection ToBaseSchemaCollection(){
- SharpQuerySchemaClassCollection returnValues = new SharpQuerySchemaClassCollection();
- foreach( SharpQueryParameter par in this ){
- returnValues.Add( par );
- }
- return returnValues;
- }
- }
-
- [Serializable()]
- public class SharpQueryStringDictionary : Dictionary
- {
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/ADOConnectionWrapper.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/ADOConnectionWrapper.cs
deleted file mode 100644
index 0020e70868..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/ADOConnectionWrapper.cs
+++ /dev/null
@@ -1,554 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Data;
-using System.Data.OleDb;
-
-using SharpQuery.Collections;
-using SharpQuery.Exceptions;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Connection
-{
-
- //
- // ADO .NET Wrapper (better than OleDB)
- //
- ///
- /// This class is associated with a class
- ///
- public class ADOConnectionWrapper : AbstractSharpQueryConnectionWrapper
- {
- protected ADODB.ConnectionClass pADOConnection;
-
- ///
- /// OLEDB connection String.
- /// i use this for speed up the code writing ...
- ///
- public override string ConnectionString
- {
- get
- {
- return base.ConnectionString;
- }
-
- set
- {
- if (IsOpen == true)
- {
- this.Close();
- }
- try
- {
- this.pADOConnection.ConnectionString = value;
- wrongConnectionString = false;
- }
- catch (System.Exception)
- {
- string mes = this.ConnectionString + "\n\r";
- wrongConnectionString = true;
-
- foreach (ADODB.Error err in this.pADOConnection.Errors)
- {
- mes += "-----------------\n\r";
- mes += err.Description + "\n\r";
- mes += err.NativeError + "\n\r";
- }
- throw new ConnectionStringException(mes);
- }
- }
- }
-
- public override bool IsOpen
- {
- get
- {
- return (pADOConnection.State == (int)ADODB.ObjectStateEnum.adStateOpen);
- }
- }
-
- public override object GetProperty(AbstractSharpQueryConnectionWrapper.SharpQueryPropertyEnum property)
- {
- object returnValue = null;
- string Key = null;
-
- switch (property)
- {
- case SharpQueryPropertyEnum.Catalog:
- Key = "Current Catalog";
- break;
- case SharpQueryPropertyEnum.ConnectionString:
- returnValue = this.pADOConnection.ConnectionString.ToString();
- break;
- case SharpQueryPropertyEnum.DataSource:
- Key = "Data Source";
- break;
- case SharpQueryPropertyEnum.DataSourceName:
- Key = "Data Source Name";
- break;
- case SharpQueryPropertyEnum.DBMSName:
- Key = "DBMS Name";
- break;
- case SharpQueryPropertyEnum.ProviderName:
- returnValue = this.pADOConnection.Provider.ToString();
- break;
- default:
- Key = null;
- break;
- }
-
- try
- {
- if (Key != null)
- {
- if (this.pADOConnection.Properties[Key].Value != null)
- {
- returnValue = this.pADOConnection.Properties[Key].Value;
- }
- }
- }
- catch (System.Exception)
- {
- returnValue = null;
- }
-
- return returnValue;
- }
-
- ///
- /// Creates a new DataConnection object
- ///
- public ADOConnectionWrapper()
- : base()
- {
- this.pADOConnection = new ADODB.ConnectionClass();
- }
-
- public ADOConnectionWrapper(string connectionString)
- : this()
- {
- this.ConnectionString = connectionString;
- }
-
- protected override void OnRefresh()
- {
- this.pADOConnection.Properties.Refresh();
-
- base.OnRefresh();
- }
-
- public override bool Open()
- {
- try
- {
- if (this.IsOpen == false && wrongConnectionString == false)
- {
- this.pADOConnection.GetType().InvokeMember(
- "Open",
- System.Reflection.BindingFlags.InvokeMethod,
- null,
- this.pADOConnection,
- null);
- }
- }
- catch (System.Exception)
- {
- string mes = this.ConnectionString + "\n\r";
- wrongConnectionString = true;
-
- foreach (ADODB.Error err in this.pADOConnection.Errors)
- {
- mes += "-----------------\n\r";
- mes += err.Description + "\n\r";
- mes += err.NativeError + "\n\r";
- }
- throw new OpenConnectionException(mes);
- }
-
- return this.IsOpen;
- }
-
- public override void Close()
- {
- if (this.IsOpen == true)
- {
- this.pADOConnection.Close();
- }
- }
-
- ///
- /// Execute a SQL command
- ///
- /// SQL command to execute
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- ///
- ///
- public override object ExecuteSQL(string SQLText, int rows)
- {
- ADODB.Recordset record = new ADODB.Recordset();
- DataTable table = null;
-
- this.pADOConnection.BeginTrans();
-
- try
- {
- record.MaxRecords = rows;
- record.Open((object)SQLText,
- (object)this.pADOConnection,
- ADODB.CursorTypeEnum.adOpenDynamic,
- ADODB.LockTypeEnum.adLockPessimistic,
- (int)ADODB.CommandTypeEnum.adCmdText
- );
-
- table = RecordSetToDataTable(record);
- }
- catch (System.Exception)
- {
- this.pADOConnection.RollbackTrans();
-
- string mes = SQLText + "\n\r";
-
- foreach (ADODB.Error err in this.pADOConnection.Errors)
- {
- mes += "-----------------\n\r";
- mes += err.Description + "\n\r";
- mes += err.NativeError + "\n\r";
- }
- throw new ExecuteSQLException(mes);
- }
- finally
- {
- this.pADOConnection.CommitTrans();
- }
-
- return table;
- }
-
-
- protected ADODB.ParameterDirectionEnum ParamDirectionToADODirection(ParameterDirection dir)
- {
- ADODB.ParameterDirectionEnum ret = ADODB.ParameterDirectionEnum.adParamInput;
-
- switch (dir)
- {
- case ParameterDirection.Input: ret = ADODB.ParameterDirectionEnum.adParamInput; break;
- case ParameterDirection.InputOutput: ret = ADODB.ParameterDirectionEnum.adParamInputOutput; break;
- case ParameterDirection.Output: ret = ADODB.ParameterDirectionEnum.adParamOutput; break;
- case ParameterDirection.ReturnValue: ret = ADODB.ParameterDirectionEnum.adParamReturnValue; break;
- default: throw new ArgumentOutOfRangeException("dir");
- }
-
- return ret;
- }
-
-
- protected ADODB.DataTypeEnum DbTypeToDataType(DbType t)
- {
- ADODB.DataTypeEnum ret = ADODB.DataTypeEnum.adChar;
-
- switch (t)
- {
- case DbType.AnsiString: ret = ADODB.DataTypeEnum.adChar; break;
- case DbType.Binary: ret = ADODB.DataTypeEnum.adBinary; break;
- case DbType.Boolean: ret = ADODB.DataTypeEnum.adBoolean; break;
- case DbType.Byte: ret = ADODB.DataTypeEnum.adUnsignedTinyInt; break;
- case DbType.Currency: ret = ADODB.DataTypeEnum.adCurrency; break;
- case DbType.Date: ret = ADODB.DataTypeEnum.adDate; break;
- case DbType.DateTime: ret = ADODB.DataTypeEnum.adDBTimeStamp; break;
- case DbType.Decimal: ret = ADODB.DataTypeEnum.adDecimal; break;
- case DbType.Double: ret = ADODB.DataTypeEnum.adDouble; break;
- case DbType.Guid: ret = ADODB.DataTypeEnum.adGUID; break;
- case DbType.Int16: ret = ADODB.DataTypeEnum.adSmallInt; break;
- case DbType.Int32: ret = ADODB.DataTypeEnum.adInteger; break;
- case DbType.Int64: ret = ADODB.DataTypeEnum.adBigInt; break;
- case DbType.Object: ret = ADODB.DataTypeEnum.adUserDefined; break;
- case DbType.SByte: ret = ADODB.DataTypeEnum.adTinyInt; break;
- case DbType.Single: ret = ADODB.DataTypeEnum.adSingle; break;
- case DbType.String: ret = ADODB.DataTypeEnum.adVarWChar; break;
- case DbType.StringFixedLength: ret = ADODB.DataTypeEnum.adWChar; break;
- case DbType.Time: ret = ADODB.DataTypeEnum.adDBTime; break;
- case DbType.UInt16: ret = ADODB.DataTypeEnum.adUnsignedSmallInt; break;
- case DbType.UInt32: ret = ADODB.DataTypeEnum.adUnsignedInt; break;
- case DbType.UInt64: ret = ADODB.DataTypeEnum.adUnsignedBigInt; break;
- case DbType.VarNumeric: ret = ADODB.DataTypeEnum.adVarNumeric; break;
- default: throw new ArgumentOutOfRangeException("t");
- }
-
- return ret;
- }
-
-
-
- ///
- /// Execute a stocked procedure.
- ///
- /// SchemaClass object.
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- ///
- ///
- public override object ExecuteProcedure(ISchemaClass schema, int rows, SharpQuerySchemaClassCollection parameters)
- {
- DataTable table = null;
-
- if (schema == null)
- {
- throw new System.ArgumentNullException("schema");
- }
-
- ADODB.Recordset record = null;
- ADODB.Command command = new ADODB.Command();
- command.ActiveConnection = this.pADOConnection;
- ADODB.Parameter para = null;
-
- command.CommandText = schema.Name;
- command.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc;
-
- if (parameters != null)
- {
- foreach (SharpQueryParameter classParam in parameters)
- {
- para = new ADODB.Parameter();
- para.Type = DbTypeToDataType(classParam.DataType);
- para.Direction = ParamDirectionToADODirection(classParam.Type);
- para.Name = classParam.Name;
- if (para.Name.StartsWith("["))
- {
- para.Name = para.Name.Remove(0, 1);
- }
- if (para.Name.EndsWith("]"))
- {
- para.Name = para.Name.Remove(para.Name.Length - 1, 1);
- }
- para.Value = classParam.Value;
- command.Parameters.Append(para);
- }
- }
-
- this.pADOConnection.BeginTrans();
-
- try
- {
- record = (ADODB.Recordset)command.GetType().InvokeMember(
- "Execute",
- System.Reflection.BindingFlags.InvokeMethod,
- null,
- command,
- null);
-
- //record.MaxRecords = rows;
- table = RecordSetToDataTable(record);
-
- //Procedure is ReadOnly
- table.DefaultView.AllowDelete = false;
- table.DefaultView.AllowEdit = false;
- table.DefaultView.AllowNew = false;
- }
- catch (System.Exception e)
- {
- if (schema != null)
- {
- this.pADOConnection.RollbackTrans();
-
- string mes = schema.Name + "\n\r";
-
- foreach (ADODB.Error err in this.pADOConnection.Errors)
- {
- mes += "-----------------\n\r";
- mes += err.Description + "\n\r";
- mes += err.NativeError + "\n\r";
- }
- throw new ExecuteProcedureException(mes);
- }
- else
- {
- throw new ExecuteProcedureException(e.Message);
- }
- }
-
- this.pADOConnection.CommitTrans();
-
- return table;
- }
-
- ///
- /// check the internal connection object is valid
- /// Throw an exception if pADOConnection == null
- ///
- protected override void CheckConnectionObject()
- {
- if (this.pADOConnection == null)
- throw new ArgumentNullException("pADONETConnection");
- }
-
- protected DataTable RecordSetToDataTable(ADODB.Recordset record)
- {
- OleDbDataAdapter custDA = new OleDbDataAdapter();
- DataTable custTable = new DataTable();
- custDA.Fill(custTable, record);
- return custTable;
- }
-
- protected override DataTable GetSchema(SharpQuerySchemaEnum schema, object[] restrictions)
- {
- ADODB.SchemaEnum internalSchema = 0;
- ADODB.Recordset ADOrecord = null;
-
- switch (schema)
- {
- case SharpQuerySchemaEnum.Asserts:
- internalSchema = ADODB.SchemaEnum.adSchemaAsserts;
- break;
- case SharpQuerySchemaEnum.Catalogs:
- internalSchema = ADODB.SchemaEnum.adSchemaCatalogs;
- break;
- case SharpQuerySchemaEnum.CharacterSets:
- internalSchema = ADODB.SchemaEnum.adSchemaCharacterSets;
- break;
- case SharpQuerySchemaEnum.CheckConstraints:
- internalSchema = ADODB.SchemaEnum.adSchemaCheckConstraints;
- break;
- case SharpQuerySchemaEnum.Collations:
- internalSchema = ADODB.SchemaEnum.adSchemaCollations;
- break;
- case SharpQuerySchemaEnum.ColumnPrivileges:
- internalSchema = ADODB.SchemaEnum.adSchemaColumnPrivileges;
- break;
- case SharpQuerySchemaEnum.Columns:
- internalSchema = ADODB.SchemaEnum.adSchemaColumns;
- break;
- case SharpQuerySchemaEnum.ColumnsDomainUsage:
- internalSchema = ADODB.SchemaEnum.adSchemaColumnsDomainUsage;
- break;
- case SharpQuerySchemaEnum.ConstraintColumnUsage:
- internalSchema = ADODB.SchemaEnum.adSchemaConstraintColumnUsage;
- break;
- case SharpQuerySchemaEnum.ConstaintTableUsage:
- internalSchema = ADODB.SchemaEnum.adSchemaConstraintTableUsage;
- break;
- case SharpQuerySchemaEnum.Cubes:
- internalSchema = ADODB.SchemaEnum.adSchemaCubes;
- break;
- case SharpQuerySchemaEnum.DBInfoKeyWords:
- internalSchema = ADODB.SchemaEnum.adSchemaDBInfoKeywords;
- break;
- case SharpQuerySchemaEnum.DBInfoLiterals:
- internalSchema = ADODB.SchemaEnum.adSchemaDBInfoLiterals;
- break;
- case SharpQuerySchemaEnum.Dimensions:
- internalSchema = ADODB.SchemaEnum.adSchemaDimensions;
- break;
- case SharpQuerySchemaEnum.ForeignKeys:
- internalSchema = ADODB.SchemaEnum.adSchemaForeignKeys;
- break;
- case SharpQuerySchemaEnum.Hierarchies:
- internalSchema = ADODB.SchemaEnum.adSchemaHierarchies;
- break;
- case SharpQuerySchemaEnum.Indexes:
- internalSchema = ADODB.SchemaEnum.adSchemaIndexes;
- break;
- case SharpQuerySchemaEnum.KeyColumnUsage:
- internalSchema = ADODB.SchemaEnum.adSchemaKeyColumnUsage;
- break;
- case SharpQuerySchemaEnum.Levels:
- internalSchema = ADODB.SchemaEnum.adSchemaLevels;
- break;
- case SharpQuerySchemaEnum.Measures:
- internalSchema = ADODB.SchemaEnum.adSchemaMeasures;
- break;
- case SharpQuerySchemaEnum.Members:
- internalSchema = ADODB.SchemaEnum.adSchemaMembers;
- break;
- case SharpQuerySchemaEnum.Null:
- break;
- case SharpQuerySchemaEnum.PrimaryKeys:
- internalSchema = ADODB.SchemaEnum.adSchemaPrimaryKeys;
- break;
- case SharpQuerySchemaEnum.ProcedureColumns:
- internalSchema = ADODB.SchemaEnum.adSchemaProcedureColumns;
- break;
- case SharpQuerySchemaEnum.ProcedureParameters:
- internalSchema = ADODB.SchemaEnum.adSchemaProcedureParameters;
- break;
- case SharpQuerySchemaEnum.Procedures:
- internalSchema = ADODB.SchemaEnum.adSchemaProcedures;
- break;
- case SharpQuerySchemaEnum.Properties:
- internalSchema = ADODB.SchemaEnum.adSchemaProperties;
- break;
- case SharpQuerySchemaEnum.ProviderTypes:
- internalSchema = ADODB.SchemaEnum.adSchemaProviderTypes;
- break;
- case SharpQuerySchemaEnum.ReferentialConstraints:
- internalSchema = ADODB.SchemaEnum.adSchemaReferentialConstraints;
- break;
- case SharpQuerySchemaEnum.Schemata:
- internalSchema = ADODB.SchemaEnum.adSchemaSchemata;
- break;
- case SharpQuerySchemaEnum.SQLLanguages:
- internalSchema = ADODB.SchemaEnum.adSchemaSQLLanguages;
- break;
- case SharpQuerySchemaEnum.Statistics:
- internalSchema = ADODB.SchemaEnum.adSchemaStatistics;
- break;
- case SharpQuerySchemaEnum.TableConstraints:
- internalSchema = ADODB.SchemaEnum.adSchemaTableConstraints;
- break;
- case SharpQuerySchemaEnum.TablePrivileges:
- internalSchema = ADODB.SchemaEnum.adSchemaTablePrivileges;
- break;
- case SharpQuerySchemaEnum.Tables:
- case SharpQuerySchemaEnum.Views:
- internalSchema = ADODB.SchemaEnum.adSchemaTables;
- break;
- case SharpQuerySchemaEnum.Tanslations:
- internalSchema = ADODB.SchemaEnum.adSchemaTranslations;
- break;
- case SharpQuerySchemaEnum.Trustees:
- internalSchema = ADODB.SchemaEnum.adSchemaTrustees;
- break;
- case SharpQuerySchemaEnum.UsagePrivileges:
- internalSchema = ADODB.SchemaEnum.adSchemaUsagePrivileges;
- break;
- case SharpQuerySchemaEnum.ViewColumnUsage:
- internalSchema = ADODB.SchemaEnum.adSchemaViewColumnUsage;
- break;
- case SharpQuerySchemaEnum.ViewColumns:
- internalSchema = ADODB.SchemaEnum.adSchemaColumns;
- break;
- case SharpQuerySchemaEnum.ViewTableUsage:
- internalSchema = ADODB.SchemaEnum.adSchemaViewTableUsage;
- break;
- default:
- throw new System.ArgumentException("", "schema");
- }
-
- if (schema != SharpQuerySchemaEnum.Null)
- {
- ADOrecord = (ADODB.Recordset)this.pADOConnection.GetType().InvokeMember(
- "OpenSchema",
- System.Reflection.BindingFlags.InvokeMethod,
- null,
- this.pADOConnection,
- new Object[] { internalSchema, this.NormalizeRestrictions(restrictions) });
- }
-
- return RecordSetToDataTable(ADOrecord);
- }
-
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/AbstractSharpQueryConnectionWrapper.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/AbstractSharpQueryConnectionWrapper.cs
deleted file mode 100644
index 873d8d3533..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/AbstractSharpQueryConnectionWrapper.cs
+++ /dev/null
@@ -1,1009 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Collections.Generic;
-using System.Data;
-
-using ICSharpCode.Core;
-using SharpQuery.Collections;
-using SharpQuery.Exceptions;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Connection
-{
- ///
- /// this is a wrapper abstract class for connection with a database server.
- ///
- public abstract class AbstractSharpQueryConnectionWrapper : IConnection
- {
-
- ///
- /// SharpQuery schema enumeration.
- ///
- public enum SharpQuerySchemaEnum
- {
-
- Asserts,
- Catalogs,
- CharacterSets,
- CheckConstraints,
- Collations,
- ColumnPrivileges,
- Columns,
- ColumnsDomainUsage,
- ConstraintColumnUsage,
- ConstaintTableUsage,
- Cubes,
- DBInfoKeyWords,
- DBInfoLiterals,
- Dimensions,
- ForeignKeys,
- Hierarchies,
- Indexes,
- KeyColumnUsage,
- Levels,
- Measures,
- Members,
- Null, // ask for an empty list
- PrimaryKeys,
- ProcedureColumns,
- ProcedureParameters,
- Procedures,
- Properties,
- ProviderSpecific,
- ProviderTypes,
- ReferentialConstraints,
- Schemata,
- SQLLanguages,
- Statistics,
- TableConstraints,
- TablePrivileges,
- Tables,
- Tanslations,
- Trustees,
- UsagePrivileges,
- ViewColumnUsage,
- Views,
- ViewColumns,
- ViewTableUsage
- }
-
- ///
- /// Connection properties
- ///
- public enum SharpQueryPropertyEnum
- {
- Catalog,
- ConnectionString,
- DataSource,
- DataSourceName,
- DBMSName,
- ProviderName
- }
-
- //constants
- internal string SELECT = "SELECT";
- internal string FROM = "FROM";
- internal string WHERE = "WHERE";
- internal string UPDATE = "UPDATE";
- internal string SET = "SET";
- internal string DELETE = "DELETE";
- internal string INSERINTO = "INSERT INTO";
- internal string VALUES = "VALUES";
- internal string AND = "AND";
-
- protected bool wrongConnectionString = false;
- protected SharpQueryListDictionary pEntities = null;
-
-
- ///
- /// return true if the connection string is invalid.
- ///
- public bool IsConnectionStringWrong
- {
- get
- {
- return this.wrongConnectionString;
- }
- }
- ///return the catalog name. If there aren't a ctalog name
- /// in the ConnectionString, return "".
- ///
- public virtual string CatalogName
- {
- get
- {
- object returnValue = this.GetProperty(SharpQueryPropertyEnum.Catalog);
-
- if (returnValue == null)
- {
- returnValue = "";
- }
-
- return returnValue.ToString();
- }
- }
-
- public virtual string SchemaName
- {
- get
- {
- return "";//"INFORMATION_SCHEMA";
- }
- }
-
- public string Name
- {
- get
- {
- string Datasource;
-
- object returnValue = null;
-
- Datasource = this.GetProperty(SharpQueryPropertyEnum.DBMSName).ToString();
- if (Datasource == null)
- {
- Datasource = "";
- }
-
- if (Datasource != "")
- {
- returnValue += Datasource + ".";
- }
-
- Datasource = this.GetProperty(SharpQueryPropertyEnum.DataSource).ToString();
- if (Datasource == null)
- {
- Datasource = "";
- }
-
- if (Datasource != "")
- {
- returnValue += Datasource + ".";
- }
-
- if (this.CatalogName != "")
- {
- returnValue += this.CatalogName + ".";
- }
-
- return returnValue.ToString();
- }
- }
-
- ///return : Name.
- public string NormalizedName
- {
- get
- {
- return this.Name + "." + this.ConnectionString;
- }
- }
-
- public SharpQueryListDictionary Entities
- {
- get
- {
- return this.pEntities;
- }
- }
-
- ///
- /// OLEDB connection String.
- /// i use this for speed up the code writing ...
- ///
- public virtual string ConnectionString
- {
- get
- {
- return this.GetProperty(SharpQueryPropertyEnum.ConnectionString).ToString();
- }
-
- set
- {
- }
- }
-
- public virtual string Provider
- {
- get
- {
- return this.GetProperty(SharpQueryPropertyEnum.ProviderName).ToString();
- }
- }
-
- public abstract bool IsOpen
- {
- get;
- }
-
-
- public abstract object GetProperty(AbstractSharpQueryConnectionWrapper.SharpQueryPropertyEnum property);
-
- ///
- /// Creates a new DataConnection object
- ///
- public AbstractSharpQueryConnectionWrapper()
- {
- this.pEntities = new SharpQueryListDictionary();
- }
-
- ///
- /// Creates a new DataConnection object from a connection string
- ///
- public AbstractSharpQueryConnectionWrapper(string connectionString)
- : this()
- {
- }
-
- static private IConnection CreateConnectionObject(string connectionstring)
- {
- try
- {
- AddInTreeNode AddinNode = AddInTree.GetTreeNode("/SharpQuery/Connection");
- IConnection conn = (IConnection)AddinNode.BuildChildItem("ConnectionWrapper", null, null);
- conn.ConnectionString = connectionstring;
- return conn;
- }
- catch (System.Exception e)
- {
- throw new ConnectionStringException(e.Message);
- }
- }
-
- static public IConnection CreateFromDataConnectionLink()
- {
- ADODB._Connection AdoConnection;
- MSDASC.DataLinks dataLink = new MSDASC.DataLinks();
- IConnection connection = null;
-
- AdoConnection = null;
- AdoConnection = (ADODB._Connection)dataLink.PromptNew();
-
- if ((AdoConnection != null) && (AdoConnection.ConnectionString != ""))
- {
- connection = CreateConnectionObject(AdoConnection.ConnectionString);
- }
-
- return connection;
- }
-
- static public IConnection UpDateFromDataConnectionLink(IConnection oldConnection)
- {
- object AdoConnection;
- MSDASC.DataLinks dataLink = new MSDASC.DataLinks();
- IConnection connection = null;
-
- AdoConnection = new ADODB.Connection();
- (AdoConnection as ADODB.Connection).ConnectionString = oldConnection.ConnectionString;
-
- if (dataLink.PromptEdit(ref AdoConnection))
- {
- connection = CreateConnectionObject((AdoConnection as ADODB.Connection).ConnectionString);
- }
-
- return connection;
- }
-
- static public IConnection CreateFromConnectionString(string stringConnection)
- {
- IConnection connection = null;
-
- if ((stringConnection != null) && (stringConnection != ""))
- {
- connection = CreateConnectionObject(stringConnection);
- }
-
- return connection;
- }
-
- public abstract bool Open();
- public abstract void Close();
-
- ///
- /// called by Refresh just after the Clear and before childs'refresh.
- /// In this, you could change the Entities dicntionnary.
- ///
- protected virtual void OnRefresh()
- {
- SharpQuerySchemaClassCollection cl;
-
- if (this.pEntities != null)
- {
- cl = new SharpQuerySchemaClassCollection();
- cl.Add(new SharpQueryTables(this, this.CatalogName, this.SchemaName, this.Name, "TABLES"));
- this.pEntities.Add("TABLES", cl);
-
- cl = new SharpQuerySchemaClassCollection();
- cl.Add(new SharpQueryViews(this, this.CatalogName, this.SchemaName, this.Name, "VIEWS"));
- this.pEntities.Add("VIEWS", cl);
-
- cl = new SharpQuerySchemaClassCollection();
- cl.Add(new SharpQueryProcedures(this, this.CatalogName, this.SchemaName, this.Name, "PROCEDURES"));
- this.pEntities.Add("PROCEDURES", cl);
- }
- }
-
- ///Refresh all dynamic properties of this connection
- public void Refresh()
- {
- this.Clear();
-
- if (this.IsOpen == true)
- {
- this.OnRefresh();
- }
- }
-
- public void Clear()
- {
- if (this.pEntities != null)
- {
- this.pEntities.Clear();
-
- //Let do the Garbage collector to clear the SharpQuerySchmaClassCollection childs.
- // It wil be do in a thread (by the garbage collector), it will be better
- }
- }
-
- ///
- /// Execute a SQL command
- ///
- /// SQL command to execute
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- ///
- ///
- public abstract object ExecuteSQL(string SQLText, int rows);
- //TODO : Parameter param.
-
- ///
- /// Execute a stocked procedure.
- ///
- /// SchemaClass object.
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- ///
- ///
- public abstract object ExecuteProcedure(ISchemaClass schema, int rows, SharpQuerySchemaClassCollection parameters);
-
- ///
- /// Extract Data from a Table or a View
- ///
- /// SchemaClass object.
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- ///
- ///
- public object ExtractData(ISchemaClass schema, int rows)
- {
-
- if (schema == null)
- {
- throw new System.ArgumentNullException("schema");
- }
-
- string SQLSelect = this.SELECT + " ";
- string SQLFrom = this.FROM + " ";
- SharpQuerySchemaClassCollection entitieslist = null;
-
- SQLFrom += schema.Name;
-
- schema.Refresh();
- //we have only a table or view :o)
- foreach (KeyValuePair DicEntry in schema.Entities)
- {
- entitieslist = DicEntry.Value as SharpQuerySchemaClassCollection;
- break;
- }
-
- if (entitieslist == null)
- {
- throw new System.ArgumentNullException("entitieslist");
- }
-
- foreach (ISchemaClass column in entitieslist)
- {
- SQLSelect += column.NormalizedName;
- SQLSelect += ",";
- }
-
- SQLSelect = SQLSelect.TrimEnd(new Char[] { ',' });
- if (entitieslist.Count == 0)
- {
- SQLSelect += "*";
- }
- SQLSelect += " ";
-
- return this.ExecuteSQL(SQLSelect + SQLFrom, 0);
- }
-
-
- ///
- /// Update row's fields into the current opened database.
- /// a row
- /// a schema
- /// it use a transaction for each row, so it's a very long process
- /// if you should update something like 10 000 lines ;o). It's used only by the DataView.
- /// If you need a better way write a "BatchUpdate" function
- ///
- ///
- public void UpDateRow(ISchemaClass schema, DataRow row)
- {
- if (schema == null)
- {
- throw new System.ArgumentNullException("schema");
- }
-
- if (row == null)
- {
- throw new System.ArgumentNullException("row");
- }
-
- string SQLUpdate = this.UPDATE + " ";
- string SQLWhere = this.WHERE + " ";
- string SQLValues = this.SET + " ";
-
- SQLUpdate += schema.Name;
- SQLUpdate += " ";
-
- foreach (DataColumn column in row.Table.Columns)
- {
- if (column.ReadOnly == false
- && column.AutoIncrement == false
- )
- {
- SQLValues += schema.Name + "." + AbstractSharpQuerySchemaClass.CheckWhiteSpace(column.ColumnName);
- SQLValues += "=";
- if (column.DataType.Equals(System.Type.GetType("System.String"))
- || column.DataType.Equals(System.Type.GetType("System.Char"))
- )
- {
- SQLValues += "'";
- }
- SQLValues += row[column.ColumnName];
- if (column.DataType.Equals(System.Type.GetType("System.String"))
- || column.DataType.Equals(System.Type.GetType("System.Char"))
- )
- {
- SQLValues += "'";
- }
-
- SQLValues += ",";
- }
-
- SQLWhere += SharpQuery.SchemaClass.AbstractSharpQuerySchemaClass.CheckWhiteSpace(column.ColumnName);
- SQLWhere += "=";
- if (column.DataType.Equals(System.Type.GetType("System.String"))
- || column.DataType.Equals(System.Type.GetType("System.Char"))
- )
- {
- SQLWhere += "'";
- }
- SQLWhere += row[column.ColumnName, DataRowVersion.Original];
- if (column.DataType.Equals(System.Type.GetType("System.String"))
- || column.DataType.Equals(System.Type.GetType("System.Char"))
- )
- {
- SQLWhere += "'";
- }
-
- if (row.Table.Columns.IndexOf(column) != (row.Table.Columns.Count - 1))
- {
- SQLWhere += " " + this.AND + " ";
- }
- }
-
- SQLValues = SQLValues.TrimEnd(new Char[] { ',' });
-
- this.ExecuteSQL(SQLUpdate + SQLValues + SQLWhere, 0);
- row.AcceptChanges();
- }
-
- ///
- /// Delete row into the current opened database.
- /// a row
- /// a schema
- /// it use a transaction for each row, so it's a very long process
- /// if you should update something like 10 000 lines ;o). It's used only by the DataView.
- /// If you need a better way write a "BatchUpdate" function
- ///
- ///
- public void DeleteRow(ISchemaClass schema, DataRow row)
- {
- if (schema == null)
- {
- throw new System.ArgumentNullException("schema");
- }
-
- if (row == null)
- {
- throw new System.ArgumentNullException("row");
- }
-
- string SQLDelete = this.DELETE + " ";
- string SQLWhere = this.WHERE + " ";
- string SQLFrom = this.FROM + " ";
-
- SQLFrom += schema.Name;
- SQLFrom += " ";
-
- foreach (DataColumn column in row.Table.Columns)
- {
- //SQLDelete += schema.Name + "." + column.ColumnName;
-
- SQLWhere += SharpQuery.SchemaClass.AbstractSharpQuerySchemaClass.CheckWhiteSpace(column.ColumnName);
- SQLWhere += "=";
- if (column.DataType.Equals(System.Type.GetType("System.String"))
- || column.DataType.Equals(System.Type.GetType("System.Char"))
- )
- {
- SQLWhere += "'";
- }
- SQLWhere += row[column.ColumnName, DataRowVersion.Original];
- if (column.DataType.Equals(System.Type.GetType("System.String"))
- || column.DataType.Equals(System.Type.GetType("System.Char"))
- )
- {
- SQLWhere += "'";
- }
-
- if (row.Table.Columns.IndexOf(column) != (row.Table.Columns.Count - 1))
- {
- //SQLDelete += ",";
- SQLWhere += " " + this.AND + " ";
- }
- else
- {
- //SQLDelete += " ";
- }
- }
-
- this.ExecuteSQL(SQLDelete + SQLFrom + SQLWhere, 0);
- row.AcceptChanges();
- }
-
- ///
- /// Insert row into the current opened database.
- /// a row
- /// a schema
- /// it use a transaction for each row, so it's a very long process
- /// if you should update something like 10 000 lines ;o). It's used only by the DataView.
- /// If you need a better way write a "BatchUpdate" function
- ///
- ///
- public void InsertRow(ISchemaClass schema, DataRow row)
- {
- if (schema == null)
- {
- throw new System.ArgumentNullException("schema");
- }
-
- if (row == null)
- {
- throw new System.ArgumentNullException("row");
- }
-
- string SQLInsert = this.INSERINTO + " ";
- string SQLValues = this.VALUES + " (";
-
- SQLInsert += schema.Name;
- SQLInsert += " (";
-
- foreach (DataColumn column in row.Table.Columns)
- {
- if (column.ReadOnly == false
- && column.AutoIncrement == false
- )
- {
- SQLInsert += /*schema.Name + "." + //Full qualified name not supported by some provider*/ SharpQuery.SchemaClass.AbstractSharpQuerySchemaClass.CheckWhiteSpace(column.ColumnName);
-
- if (column.DataType.Equals(System.Type.GetType("System.String"))
- || column.DataType.Equals(System.Type.GetType("System.Char"))
- )
- {
- SQLValues += "'";
- }
- SQLValues += row[column.ColumnName, DataRowVersion.Current];
- if (column.DataType.Equals(System.Type.GetType("System.String"))
- || column.DataType.Equals(System.Type.GetType("System.Char"))
- )
- {
- SQLValues += "'";
- }
-
- SQLValues += ",";
- SQLInsert += ",";
- }
- }
-
- SQLValues = SQLValues.TrimEnd(new Char[] { ',' });
- SQLInsert = SQLInsert.TrimEnd(new Char[] { ',' });
-
- SQLInsert += ") ";
- SQLValues += ")";
-
-
- this.ExecuteSQL(SQLInsert + SQLValues, 0);
- row.AcceptChanges();
- }
-
- /// throw a exception if the is null
- protected abstract void CheckConnectionObject();
-
- /// each elements of the restrictions array which are an empty string is replaced with a null reference
- protected object[] NormalizeRestrictions(object[] restrictions)
- {
- object[] newRestrictions = null;
-
- if (restrictions != null)
- {
- newRestrictions = new object[restrictions.Length];
- object restriction;
-
- for (int i = 0; i < restrictions.Length; i++)
- {
- restriction = restrictions[i];
-
- if (restriction != null)
- {
- if ((restriction is string) && ((restriction as string) == ""))
- {
- restriction = null;
- }
- }
-
- newRestrictions[i] = restriction;
- }
- }
- return newRestrictions;
- }
-
- ///
- /// return a schema matching restrictions
- /// a SharpQuerySchemaEnum.
- /// Restrictions matching the schema
- ///
- protected abstract DataTable GetSchema(SharpQuerySchemaEnum schema, object[] restrictions);
-
-
- //
- // IConnection methods
- //
-
- public SharpQuerySchemaClassCollection GetSchemaCatalogs(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.Catalogs;
- object[] restrictions = new object[] { schema.InternalName };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
-
- //TODO : add not supported schema code!
-
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- list.Add(new SharpQueryCatalog(this, row["CATALOG_NAME"].ToString(), "", "", row["CATALOG_NAME"].ToString()));
- }
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.Catalogs"));
- }
-
- return list;
- }
-
- public SharpQuerySchemaClassCollection GetSchemaSchemas(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.Schemata;
- object[] restrictions = new object[] { schema.CatalogName, "", "" };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
-
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- list.Add(new SharpQuerySchema(this, row["CATALOG_NAME"].ToString(), row["SCHEMA_NAME"].ToString(), "", row["SCHEMA_NAME"].ToString()));
- }
-
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.Schemata"));
- }
-
- return list;
- }
-
- public SharpQuerySchemaClassCollection GetSchemaTables(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.Tables;
- object[] restrictions = new object[] { schema.CatalogName, schema.SchemaName, "", "TABLE" };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
-
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- list.Add(new SharpQueryTable(this, row["TABLE_CATALOG"].ToString(), row["TABLE_SCHEMA"].ToString(), "", row["TABLE_NAME"].ToString()));
- }
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.Tables"));
- }
-
- return list;
- }
-
- public SharpQuerySchemaClassCollection GetSchemaViews(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.Views;
- object[] restrictions = new object[] { schema.CatalogName, schema.SchemaName, "", "VIEW" };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
-
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- list.Add(new SharpQueryView(this, row["TABLE_CATALOG"].ToString(), row["TABLE_SCHEMA"].ToString(), "", row["TABLE_NAME"].ToString()));
- }
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.Views"));
- }
-
- return list;
- }
-
- public SharpQuerySchemaClassCollection GetSchemaProcedures(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.Procedures;
- object[] restrictions = new object[] { schema.CatalogName, schema.SchemaName, "", "" };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
-
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- list.Add(new SharpQueryProcedure(this, row["PROCEDURE_CATALOG"].ToString(), row["PROCEDURE_SCHEMA"].ToString(), "", row["PROCEDURE_NAME"].ToString().Split(';')[0]));
- }
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.Procedures"));
- }
-
- return list;
- }
-
- public SharpQuerySchemaClassCollection GetSchemaTableColumns(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.Columns;
- object[] restrictions = new object[] { schema.CatalogName, schema.SchemaName, schema.InternalName, "" };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
-
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- list.Add(new SharpQueryColumn(this, schema.CatalogName, schema.SchemaName, schema.Name, row["COLUMN_NAME"].ToString()));
- }
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.Columns"));
- }
-
- return list;
- }
-
- public SharpQuerySchemaClassCollection GetSchemaViewColumns(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.ViewColumns;
- object[] restrictions = new object[] { schema.CatalogName, schema.SchemaName, schema.InternalName, "" };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
-
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- list.Add(new SharpQueryColumn(this, schema.CatalogName, schema.SchemaName, schema.Name, row["COLUMN_NAME"].ToString()));
- }
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.Columns"));
- }
-
- return list;
- }
-
- public SharpQuerySchemaClassCollection GetSchemaProcedureColumns(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.ProcedureColumns;
- object[] restrictions = new object[] { schema.CatalogName, schema.SchemaName, schema.InternalName, "" };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
-
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- list.Add(new SharpQueryColumn(this, schema.CatalogName, schema.SchemaName, schema.Name, row["COLUMN_NAME"].ToString()));
- }
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.ProcedureColumns"));
- }
-
- return list;
- }
-
- public SharpQuerySchemaClassCollection GetSchemaProcedureParameters(ISchemaClass schema)
- {
- SharpQuerySchemaClassCollection list = new SharpQuerySchemaClassCollection();
- DataTable record = null;
- SharpQuerySchemaEnum schematype = SharpQuerySchemaEnum.ProcedureParameters;
- object[] restrictions = new object[] { schema.CatalogName, schema.SchemaName, schema.InternalName, "" };
-
- try
- {
- record = this.GetSchema(schematype, restrictions);
- SharpQueryParameter par = null;
- if (record != null)
- {
- foreach (DataRow row in record.Rows)
- {
- par = new SharpQueryParameter(this, schema.CatalogName, schema.SchemaName, schema.Name, row["PARAMETER_NAME"].ToString());
- par.DataType = StringToDbType(row["DATA_TYPE"].ToString());
- par.Type = StringToParamDirection(row["PARAMETER_TYPE"].ToString());
-
- if (par.Type != ParameterDirection.ReturnValue)
- {
- list.Add(par);
- }
- }
- }
- }
- catch (System.Exception)
- {
- list.Add(new SharpQueryNotSupported(this, "", "", "", "SharpQuerySchemaEnum.ProcedureParameters"));
- }
-
- return list;
- }
-
-
- protected DbType StringToDbType(string value)
- {
- return IntToDbType(int.Parse(value));
- }
-
- protected DbType IntToDbType(int value)
- {
- DbType retValue;
- switch (value)
- {
- case 129: retValue = DbType.AnsiString; break;
- //case 1 : retValue = DbType.AnsiStringFixedLength; break;
- case 128: retValue = DbType.Binary; break;
- case 11: retValue = DbType.Boolean; break;
- case 17: retValue = DbType.Byte; break;
- case 6: retValue = DbType.Currency; break;
- case 7:
- case 133: retValue = DbType.Date; break;
- case 135: retValue = DbType.DateTime; break;
- case 14: retValue = DbType.Decimal; break;
- case 5: retValue = DbType.Double; break;
- case 72: retValue = DbType.Guid; break;
- case 2: retValue = DbType.Int16; break;
- case 3: retValue = DbType.Int32; break;
- case 20: retValue = DbType.Int64; break;
- case 12:
- case 132: retValue = DbType.Object; break;
- case 16: retValue = DbType.SByte; break;
- case 4: retValue = DbType.Single; break;
- case 130: retValue = DbType.String; break;
- case 8: retValue = DbType.StringFixedLength; break;
- case 134: retValue = DbType.Time; break;
- case 18: retValue = DbType.UInt16; break;
- case 19: retValue = DbType.UInt32; break;
- case 21: retValue = DbType.UInt64; break;
- case 131: retValue = DbType.VarNumeric; break;
- default: throw new ArgumentOutOfRangeException("value");
- }
-
- return retValue;
- }
-
- protected ParameterDirection StringToParamDirection(string value)
- {
- return IntToParamDirection(int.Parse(value));
- }
-
- protected ParameterDirection IntToParamDirection(int value)
- {
- ParameterDirection retValue;
- switch (value)
- {
- case 1: retValue = ParameterDirection.Input; break;
- case 2: retValue = ParameterDirection.InputOutput; break;
- case 3: retValue = ParameterDirection.Output; break;
- case 4: retValue = ParameterDirection.ReturnValue; break;
- default: throw new ArgumentOutOfRangeException("value");
-
- }
-
- return retValue;
- }
-
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/IConnection.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/IConnection.cs
deleted file mode 100644
index 91e9d5bbd2..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/IConnection.cs
+++ /dev/null
@@ -1,228 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System.Data;
-using SharpQuery.Collections;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Connection
-{
- ///
- /// This interface is used by any connection wrapper class.
- ///
- public interface IConnection
- {
- ///
- /// return true if the connection string is invalid.
- ///
- bool IsConnectionStringWrong
- {
- get;
- }
- ///Return the connection string.
- string ConnectionString { get; set;}
-
- ///Provider'sname.
- ///
- string Provider { get; }
-
- ///
- /// get the connection's catalog name.
- ///
- string CatalogName { get; }
-
- ///
- /// get the connection's schema name.
- ///
- string SchemaName { get; }
-
- ///
- /// get the entity's name
- ///
- string Name { get; }
-
- ///
- /// entity's normalized name.
- ///
- /// there are a database test. In this database there are a schema
- /// named fool. In this schema there are a table named fooltable
- /// and a in this table there are a column named foolcolumn.
- /// So, the normalized name of the schema is test.[fool].
- /// The normalized name of the table is test.[fool].fooltable.
- /// The normalized name of the column is test.[fool].fooltable.foolcolumn.
- ///
- ///
- string NormalizedName { get; }
-
- ///
- ///
- /// true if the connection is opened.
- /// false if the connection is not opened.
- ///
- ///
- bool IsOpen { get; }
-
- ///
- /// Those, are list of the childs schema.( columns, etc etc )
- /// i am using a dictionnary because is more simplest to write
- /// Entities["PROCEDURES"] than Entities[0].
- ///
- SharpQueryListDictionary Entities { get; }
-
- ///
- ///
- /// an array of string with the string properties's provider
- ///
- /// properties are indexed ans sorted with SharpQueryPropertyEnum
- ///
- object GetProperty(AbstractSharpQueryConnectionWrapper.SharpQueryPropertyEnum property);
-
- ///
- /// Open a connection with the
- ///
- /// true if the connection is opened.
- /// false if the connection is not opened.
- ///
- ///
- bool Open();
-
- ///
- /// Close the connection with the server.
- ///
- void Close();
-
- ///
- /// Refresh child schemas from the database.
- ///
- void Refresh();
-
- ///
- /// Erase all child schemas
- ///
- void Clear();
-
- ///
- /// Execute a SQL command
- ///
- /// SQL command to execute
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- ///
- ///
- object ExecuteSQL(string SQLText, int rows);
-
- ///
- /// Execute a stocked procedure.
- ///
- /// SchemaClass object.
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- ///
- ///
- object ExecuteProcedure(ISchemaClass schema, int rows, SharpQuerySchemaClassCollection parameters);
-
- ///
- /// Extract Data from a Table or a View
- ///
- /// SchemaClass object.
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- ///
- ///
- object ExtractData(ISchemaClass schema, int rows);
-
- ///
- /// Update row's fields into the current opened database.
- /// a row
- /// a schema
- ///
- void UpDateRow(ISchemaClass schema, DataRow row);
-
- ///
- /// Delete row into the current opened database.
- /// a row
- /// a schema
- ///
- void DeleteRow(ISchemaClass schema, DataRow row);
-
- ///
- /// Insert row into the current opened database.
- /// a row
- /// a schema
- ///
- void InsertRow(ISchemaClass schema, DataRow row);
-
-
- ///
- /// Get 's catalogs.
- ///
- SharpQuerySchemaClassCollection GetSchemaCatalogs(ISchemaClass schema);
-
- ///
- /// Get 's Schemas.
- ///
- SharpQuerySchemaClassCollection GetSchemaSchemas(ISchemaClass schema);
-
- ///
- /// From a catalog object, get tables from all schemas.
- /// From a schema object get tables from all this schema.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaTables(ISchemaClass schema);
-
- ///
- /// From a catalog object, get views from all schemas.
- /// From a schema object get views from all this schema.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaViews(ISchemaClass schema);
-
- ///
- /// From a catalog object, get procedures from all schemas.
- /// From a schema object get procedures from all this schema.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaProcedures(ISchemaClass schema);
-
- ///
- /// From a table object, get columns from the table.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaTableColumns(ISchemaClass schema);
-
- ///
- /// From a view object, get columns from the view.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaViewColumns(ISchemaClass schema);
-
- ///
- /// From a procedure object , get columns from the procedure.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaProcedureColumns(ISchemaClass schema);
-
- ///
- /// From a procedure object , get parameters from the procedure.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaProcedureParameters(ISchemaClass schema);
- }
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/OLEDBConnectionWrapper.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/OLEDBConnectionWrapper.cs
deleted file mode 100644
index 8fa8d80741..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Connection/OLEDBConnectionWrapper.cs
+++ /dev/null
@@ -1,446 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Data;
-using System.Data.OleDb;
-
-using SharpQuery.Collections;
-using SharpQuery.Exceptions;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Connection
-{
- //
- // ADO .NET Wrapper (better than OleDB)
- //
- ///
- /// This class is associated with a class
- ///
- public class OLEDBConnectionWrapper : AbstractSharpQueryConnectionWrapper
- {
- private System.Data.OleDb.OleDbConnection pOLEConnection = null;
- private System.Data.OleDb.OleDbDataAdapter pOLEAdapter = new OleDbDataAdapter();
-
- ///
- /// OLEDB connection String.
- /// i use this for speed up the code writing ...
- ///
- public override string ConnectionString
- {
- get
- {
- return base.ConnectionString;
- }
-
- set
- {
- if (IsOpen == true)
- {
- this.Close();
- }
- try
- {
- this.pOLEConnection.ConnectionString = value;
- wrongConnectionString = false;
- }
- catch (OleDbException e)
- {
- string mes = this.ConnectionString + "\n\r";
- wrongConnectionString = true;
-
- foreach (OleDbError err in e.Errors)
- {
- mes += "-----------------\n\r";
- mes += err.Message + "\n\r";
- mes += err.NativeError + "\n\r";
- }
- throw new ConnectionStringException(mes);
- }
- catch (System.Exception e)
- {
- wrongConnectionString = true;
- throw new ConnectionStringException(value
- + "\n\r"
- + "-------------------\n\r"
- + e.Message
- );
- }
- }
- }
-
- public override bool IsOpen
- {
- get
- {
- return (this.pOLEConnection.State == ConnectionState.Open);
- }
- }
-
- public override object GetProperty(AbstractSharpQueryConnectionWrapper.SharpQueryPropertyEnum property)
- {
- object returnValue = null;
-
- switch (property)
- {
- case SharpQueryPropertyEnum.Catalog:
- case SharpQueryPropertyEnum.DataSourceName:
- returnValue = this.pOLEConnection.Database;
- break;
- case SharpQueryPropertyEnum.ConnectionString:
- returnValue = this.pOLEConnection.ConnectionString.ToString();
- break;
- case SharpQueryPropertyEnum.DataSource:
- returnValue = this.pOLEConnection.DataSource;
- break;
- case SharpQueryPropertyEnum.DBMSName:
- returnValue = "";
- break;
- case SharpQueryPropertyEnum.ProviderName:
- //Key = "Provider Name";
- returnValue = this.pOLEConnection.Provider.ToString();
- break;
- default:
- returnValue = null;
- break;
- }
-
- return returnValue;
- }
-
- ///
- /// Creates a new DataConnection object
- ///
- public OLEDBConnectionWrapper()
- : base()
- {
- this.pOLEConnection = new System.Data.OleDb.OleDbConnection();
- this.pOLEAdapter = new System.Data.OleDb.OleDbDataAdapter();
- this.pOLEAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
- }
-
- public OLEDBConnectionWrapper(string connectionString)
- : this()
- {
- this.ConnectionString = connectionString;
- }
-
- public override bool Open()
- {
- try
- {
- if (this.IsOpen == false && wrongConnectionString == false)
- {
- this.pOLEConnection.Open();
- }
- }
- catch (OleDbException e)
- {
- string mes = this.ConnectionString + "\n\r";
- wrongConnectionString = true;
-
- foreach (OleDbError err in e.Errors)
- {
- mes += "-----------------\n\r";
- mes += err.Message + "\n\r";
- mes += err.NativeError + "\n\r";
- }
- throw new OpenConnectionException(mes);
- }
- catch (System.Exception)
- {
- wrongConnectionString = true;
- throw new OpenConnectionException(this.ConnectionString);
- }
-
- return this.IsOpen;
- }
-
- public override void Close()
- {
- if (this.IsOpen == true)
- {
- this.pOLEConnection.Close();
- }
- }
-
- ///
- /// Execute a SQL command
- ///
- /// SQL command to execute
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- /// ///
- public override object ExecuteSQL(string SQLText, int rows)
- {
- OleDbCommand command = new OleDbCommand();
- DataSet returnValues = new DataSet();
-
- command.Connection = this.pOLEConnection;
- command.CommandText = SQLText;
- command.CommandType = System.Data.CommandType.Text;
-
- // some stranges things occurs with the OleDbDataAdapter and transaction
- command.Transaction = this.pOLEConnection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
-
- try
- {
- this.pOLEAdapter.SelectCommand = command;
- this.pOLEAdapter.Fill(returnValues);
-
- }
- catch (OleDbException e)
- {
- command.Transaction.Rollback();
-
- string mes = SQLText + "\n\r";
-
- foreach (OleDbError err in e.Errors)
- {
- mes += "-----------------\n\r";
- mes += err.Message + "\n\r";
- mes += err.NativeError + "\n\r";
- }
- throw new ExecuteSQLException(mes);
- }
- catch (System.Exception)
- {
- command.Transaction.Rollback();
- throw new ExecuteSQLException(SQLText);
- }
- finally
- {
- command.Transaction.Commit();
- }
-
- return returnValues;
- }
-
- ///
- /// Execute a stocked procedure.
- ///
- /// SchemaClass object.
- ///
- ///
- /// Maximum number of row to extract. If is "0" then all rows are extracted.
- ///
- /// return a DataTable
- ///or a DataSet object.
- /// ///
- public override object ExecuteProcedure(ISchemaClass schema, int rows, SharpQuerySchemaClassCollection parameters)
- {
-
- DataSet returnValues = null;
-
- if (schema == null)
- {
- throw new System.ArgumentNullException("schema");
- }
-
- OleDbCommand command = new OleDbCommand();
- OleDbParameter para = null;
- returnValues = new DataSet();
-
- command.Connection = this.pOLEConnection;
- command.CommandText = schema.Name;
- command.CommandType = System.Data.CommandType.StoredProcedure;
-
- if (parameters != null)
- {
- foreach (SharpQueryParameter classParam in parameters)
- {
- para = new OleDbParameter();
- para.DbType = classParam.DataType;
- para.Direction = (ParameterDirection)classParam.Type;
- para.ParameterName = classParam.Name;
- if (para.ParameterName.StartsWith("["))
- {
- para.ParameterName = para.ParameterName.Remove(0, 1);
- }
- if (para.ParameterName.EndsWith("]"))
- {
- para.ParameterName = para.ParameterName.Remove(para.ParameterName.Length - 1, 1);
- }
- para.Value = classParam.Value;
- command.Parameters.Add(para);
- }
- }
-
- // command.Prepare();
- command.Transaction = this.pOLEConnection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
-
- try
- {
- this.pOLEAdapter.SelectCommand = command;
- this.pOLEAdapter.Fill(returnValues);
- }
- catch (OleDbException e)
- {
- command.Transaction.Rollback();
-
- string mes = schema.Name + "\n\r";
-
- foreach (OleDbError err in e.Errors)
- {
- mes += "-----------------\n\r";
- mes += err.Message + "\n\r";
- mes += err.NativeError + "\n\r";
- }
- throw new ExecuteProcedureException(mes);
- }
- catch (System.Exception e)
- {
- command.Transaction.Rollback();
- throw new ExecuteProcedureException(e.Message);
- }
-
- command.Transaction.Commit();
-
- foreach (DataTable table in returnValues.Tables)
- {
- //readonly
- table.DefaultView.AllowDelete = false;
- table.DefaultView.AllowEdit = false;
- table.DefaultView.AllowNew = false;
- }
-
- return returnValues;
- }
-
- ///
- /// check the internal connection object is valid
- /// Throw an exception if pADOConnection == null
- ///
- protected override void CheckConnectionObject()
- {
- if (this.pOLEConnection == null)
- throw new ArgumentNullException("pOLEConnection");
- }
-
- protected override DataTable GetSchema(SharpQuerySchemaEnum schema, object[] restrictions)
- {
- System.Guid internalSchema = OleDbSchemaGuid.Assertions;
- DataTable OLErecord = null;
-
- switch (schema)
- {
- case SharpQuerySchemaEnum.Asserts:
- internalSchema = OleDbSchemaGuid.Assertions;
- break;
- case SharpQuerySchemaEnum.Catalogs:
- internalSchema = OleDbSchemaGuid.Catalogs;
- break;
- case SharpQuerySchemaEnum.CharacterSets:
- internalSchema = OleDbSchemaGuid.Character_Sets;
- break;
- case SharpQuerySchemaEnum.CheckConstraints:
- internalSchema = OleDbSchemaGuid.Check_Constraints;
- break;
- case SharpQuerySchemaEnum.Collations:
- internalSchema = OleDbSchemaGuid.Collations;
- break;
- case SharpQuerySchemaEnum.ColumnPrivileges:
- internalSchema = OleDbSchemaGuid.Column_Privileges;
- break;
- case SharpQuerySchemaEnum.Columns:
- internalSchema = OleDbSchemaGuid.Columns;
- break;
- case SharpQuerySchemaEnum.ConstraintColumnUsage:
- internalSchema = OleDbSchemaGuid.Constraint_Column_Usage;
- break;
- case SharpQuerySchemaEnum.ConstaintTableUsage:
- internalSchema = OleDbSchemaGuid.Constraint_Table_Usage;
- break;
- case SharpQuerySchemaEnum.DBInfoLiterals:
- internalSchema = OleDbSchemaGuid.DbInfoLiterals;
- break;
- case SharpQuerySchemaEnum.ForeignKeys:
- internalSchema = OleDbSchemaGuid.Foreign_Keys;
- break;
- case SharpQuerySchemaEnum.Indexes:
- internalSchema = OleDbSchemaGuid.Indexes;
- break;
- case SharpQuerySchemaEnum.KeyColumnUsage:
- internalSchema = OleDbSchemaGuid.Key_Column_Usage;
- break;
- case SharpQuerySchemaEnum.Null:
- break;
- case SharpQuerySchemaEnum.PrimaryKeys:
- internalSchema = OleDbSchemaGuid.Primary_Keys;
- break;
- case SharpQuerySchemaEnum.ProcedureColumns:
- internalSchema = OleDbSchemaGuid.Procedure_Columns;
- break;
- case SharpQuerySchemaEnum.ProcedureParameters:
- internalSchema = OleDbSchemaGuid.Procedure_Parameters;
- break;
- case SharpQuerySchemaEnum.Procedures:
- internalSchema = OleDbSchemaGuid.Procedures;
- break;
- case SharpQuerySchemaEnum.ProviderTypes:
- internalSchema = OleDbSchemaGuid.Provider_Types;
- break;
- case SharpQuerySchemaEnum.ReferentialConstraints:
- internalSchema = OleDbSchemaGuid.Referential_Constraints;
- break;
- case SharpQuerySchemaEnum.Schemata:
- internalSchema = OleDbSchemaGuid.Schemata;
- break;
- case SharpQuerySchemaEnum.SQLLanguages:
- internalSchema = OleDbSchemaGuid.Sql_Languages;
- break;
- case SharpQuerySchemaEnum.Statistics:
- internalSchema = OleDbSchemaGuid.Statistics;
- break;
- case SharpQuerySchemaEnum.TableConstraints:
- internalSchema = OleDbSchemaGuid.Table_Constraints;
- break;
- case SharpQuerySchemaEnum.TablePrivileges:
- internalSchema = OleDbSchemaGuid.Table_Privileges;
- break;
- case SharpQuerySchemaEnum.Tables:
- case SharpQuerySchemaEnum.Views:
- internalSchema = OleDbSchemaGuid.Tables;
- break;
- case SharpQuerySchemaEnum.Tanslations:
- internalSchema = OleDbSchemaGuid.Translations;
- break;
- case SharpQuerySchemaEnum.Trustees:
- internalSchema = OleDbSchemaGuid.Trustee;
- break;
- case SharpQuerySchemaEnum.UsagePrivileges:
- internalSchema = OleDbSchemaGuid.Usage_Privileges;
- break;
- case SharpQuerySchemaEnum.ViewColumnUsage:
- internalSchema = OleDbSchemaGuid.View_Column_Usage;
- break;
- case SharpQuerySchemaEnum.ViewColumns:
- internalSchema = OleDbSchemaGuid.Columns;
- break;
- case SharpQuerySchemaEnum.ViewTableUsage:
- internalSchema = OleDbSchemaGuid.View_Table_Usage;
- break;
- default:
- throw new System.ArgumentException("", "schema");
- }
-
- if (schema != SharpQuerySchemaEnum.Null)
- {
- OLErecord = this.pOLEConnection.GetOleDbSchemaTable(internalSchema, this.NormalizeRestrictions(restrictions));
- }
-
-
-
- return OLErecord;
- }
-
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ConnectionStringException.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ConnectionStringException.cs
deleted file mode 100644
index ef08f65367..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ConnectionStringException.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Runtime.Serialization;
-using ICSharpCode.Core;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Exceptions
-{
- [Serializable()]
- public class ConnectionStringException : Exception
- {
- public ConnectionStringException()
- : base(StringParser.Parse("${res:SharpQuery.Error.WrongConnectionString}"))
- {
- }
-
- public ConnectionStringException(ISchemaClass schema)
- : base(StringParser.Parse("${res:SharpQuery.Error.WrongConnectionString}")
- + "\n\r"
- + "-----------------"
- + "\n\r"
- + "(" + schema.Connection.ConnectionString + ")"
- + "\n\r"
- + "(" + schema.Connection.Name + ")"
- )
- {
- }
-
- public ConnectionStringException(string message)
- : base(StringParser.Parse("${res:SharpQuery.Error.WrongConnectionString}")
- + "\n\r"
- + "-----------------"
- + "\n\r"
- + message)
- {
- }
-
- public ConnectionStringException(string message, Exception innerException) : base(message, innerException)
- {
- }
-
- protected ConnectionStringException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ExecuteProcedureException.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ExecuteProcedureException.cs
deleted file mode 100644
index 508f19150f..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ExecuteProcedureException.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Runtime.Serialization;
-using ICSharpCode.Core;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Exceptions
-{
- [Serializable()]
- public class ExecuteProcedureException : Exception
- {
- public ExecuteProcedureException()
- : base(StringParser.Parse("${res:SharpQuery.Error.ProcedureExecution}"))
- {
- }
-
- public ExecuteProcedureException(ISchemaClass schema)
- : base(StringParser.Parse("${res:SharpQuery.Error.ProcedureExecution}")
- + "\n\r"
- + "-----------------"
- + "\n\r"
- + "(" + schema.Connection.ConnectionString + ")"
- + "\n\r"
- + "(" + schema.Connection.Name + ")"
- )
- {
- }
-
- public ExecuteProcedureException(string message)
- : base(StringParser.Parse("${res:SharpQuery.Error.ProcedureExecution}")
- + "\n\r"
- + "-----------------"
- + "\n\r"
- + message)
- {
- }
-
- public ExecuteProcedureException(string message, Exception innerException) : base(message, innerException)
- {
- }
-
- protected ExecuteProcedureException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ExecuteSQLException.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ExecuteSQLException.cs
deleted file mode 100644
index 6efa474025..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/ExecuteSQLException.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Runtime.Serialization;
-using ICSharpCode.Core;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Exceptions
-{
- [Serializable()]
- public class ExecuteSQLException : Exception
- {
- public ExecuteSQLException()
- : base(StringParser.Parse("${res:SharpQuery.Error.SQLExecution}"))
- {
- }
-
- public ExecuteSQLException(ISchemaClass schema)
- : base(StringParser.Parse("${res:SharpQuery.Error.SQLExecution}")
- + "\n\r"
- + "-----------------"
- + "\n\r"
- + "(" + schema.Connection.ConnectionString + ")"
- + "\n\r"
- + "(" + schema.Connection.Name + ")"
- )
- {
- }
-
- public ExecuteSQLException(string message)
- : base(StringParser.Parse("${res:SharpQuery.Error.SQLExecution}")
- + "\n\r"
- + "-----------------"
- + "\n\r"
- + message)
- {
- }
-
- public ExecuteSQLException(string message, Exception innerException) : base(message, innerException)
- {
- }
-
- protected ExecuteSQLException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/OpenConnectionException.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/OpenConnectionException.cs
deleted file mode 100644
index 54f27f49a3..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/OpenConnectionException.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Runtime.Serialization;
-using ICSharpCode.Core;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Exceptions
-{
- [Serializable()]
- public class OpenConnectionException : Exception
- {
- public OpenConnectionException()
- : base(StringParser.Parse("${res:SharpQuery.Error.OpenError}"))
- {
- }
-
- public OpenConnectionException(ISchemaClass schema)
- : base(StringParser.Parse("${res:SharpQuery.Error.OpenError}")
- + "\n\r"
- + "-----------------"
- + "\n\r"
- + "(" + schema.Connection.ConnectionString + ")"
- + "\n\r"
- + "(" + schema.Connection.Name + ")"
- )
- {
- }
-
- public OpenConnectionException(string message)
- : base(StringParser.Parse("${res:SharpQuery.Error.OpenError}")
- + "\n\r"
- + "-----------------"
- + "\n\r"
- + message)
- {
- }
-
- public OpenConnectionException(string message, Exception innerException) : base(message, innerException)
- {
- }
-
- protected OpenConnectionException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/SharpQueryAbstractException.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/SharpQueryAbstractException.cs
deleted file mode 100644
index 84f7331a20..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/Exceptions/SharpQueryAbstractException.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Runtime.Serialization;
-
-namespace SharpQuery.Exceptions
-{
- [Serializable()]
- public abstract class SharpQueryAbstractException : Exception
- {
- public SharpQueryAbstractException() : base()
- {
- }
-
- public SharpQueryAbstractException(string message) : base(message)
- {
- }
-
- public SharpQueryAbstractException(string message, Exception innerException) : base(message, innerException)
- {
- }
-
- protected SharpQueryAbstractException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/AbstractSharpQueryNode.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/AbstractSharpQueryNode.cs
deleted file mode 100644
index 612b6e9c44..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/AbstractSharpQueryNode.cs
+++ /dev/null
@@ -1,300 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Reflection;
-using System.Windows.Forms;
-
-using ICSharpCode.Core;
-using ICSharpCode.SharpDevelop.Gui;
-using SharpQuery.Collections;
-using SharpQuery.Connection;
-using SharpQuery.Gui.DataView;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Gui.TreeView
-{
- public abstract class AbstractSharpQueryNode : System.Windows.Forms.TreeNode, ISharpQueryNode
- {
- internal static SQLParameterInput inputform = null;
-
- ///
- /// this variable force to have a "plus" near the node.
- ///
- protected Assembly ass = null;
-
- protected ISchemaClass pSchemaClass = null;
-
- /// force to displayed a "+" for the node
- protected virtual bool NullChildAllowed
- {
- get
- {
- return true;
- }
- }
-
- public virtual string AddinContextMenu
- {
- get
- {
- return "";
- }
- }
-
- public virtual string entityNormalizedName
- {
- get
- {
- if (this.SchemaClass != null)
- {
- return AbstractSharpQuerySchemaClass.RemoveBracket(this.SchemaClass.NormalizedName);
- }
- else
- {
- return "";
- }
- }
- }
-
- public virtual string entityName
- {
- get
- {
- if (this.SchemaClass != null)
- {
- return this.SchemaClass.InternalName;
- }
- else
- {
- return "";
- }
- }
- }
-
- public ISchemaClass SchemaClass
- {
- get
- {
- if (this.pSchemaClass != null)
- {
- return this.pSchemaClass;
- }
- else
- {
- return null;
- }
- }
- }
-
- public virtual IConnection Connection
- {
- get
- {
- if (this.SchemaClass != null)
- {
- return this.SchemaClass.Connection;
- }
- else
- {
- return null;
- }
- }
- }
-
- public virtual SharpQueryListDictionary Entities
- {
- get
- {
- if (this.SchemaClass != null)
- {
- return this.SchemaClass.Entities;
- }
- else
- {
- return null;
- }
- }
- }
-
- public AbstractSharpQueryNode()
- : base()
- {
- ass = System.Reflection.Assembly.GetExecutingAssembly();
- }
-
- public AbstractSharpQueryNode(ISchemaClass schemaclass)
- : this()
- {
- this.pSchemaClass = schemaclass;
- }
-
- ///
- /// called by Refresh just after the Clear and before childs'refresh.
- /// In this, you could change the Entities dicntionnary.
- ///
- protected virtual void OnRefresh()
- {
- // Nothing !
- }
-
- public virtual void Refresh()
- {
- try
- {
- if (this.TreeView != null)
- {
- this.TreeView.BeginUpdate();
- }
-
- this.Clear();
-
- this.OnRefresh();
-
- if (this.Connection.IsOpen)
- {
- this.Text = this.entityName;
-
- if (this.IsExpanded == true)
- {
- if (this.SchemaClass != null)
- {
- this.SchemaClass.Refresh();
- }
-
- this.BuildsChilds();
- }
- }
- }
- finally
- {
- if (this.TreeView != null)
- {
- this.TreeView.EndUpdate();
- }
- }
- }
-
- public virtual void Clear()
- {
- if (this.SchemaClass != null)
- {
- this.SchemaClass.Clear();
- }
-
- this.Nodes.Clear();
-
- if ((this.IsExpanded == false) && (this.NullChildAllowed == true))
- {
- this.Nodes.Add(new TreeNode());
- }
- }
-
- ///
- /// allow the user to add some parameters while executing an SQL command
- ///
- protected virtual SharpQuerySchemaClassCollection OnExecute(CancelEventArgs e)
- {
- return null;
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- ///
- public void Execute(int rows)
- {
- try
- {
- if (this.SchemaClass != null)
- {
- CancelEventArgs e = new CancelEventArgs();
- SharpQuerySchemaClassCollection ret = this.OnExecute(e);
- if (e.Cancel == false)
- {
- WorkbenchSingleton.Workbench.ShowView(new SharpQueryDataView(this.SchemaClass, rows, ret));
- }
- }
- }
- catch (Exception e)
- {
- MessageService.ShowError(e.Message);
- }
- }
-
- public virtual void BuildsChilds()
- {
- string childclass = "";
- ISharpQueryNode ChildNode = null;
-
- if (this.Entities != null)
- {
- foreach ( KeyValuePair DicEntry in this.Entities)
- {
- if (DicEntry.Value != null)
- {
- SharpQuerySchemaClassCollection entitieslist = DicEntry.Value as SharpQuerySchemaClassCollection;
-
- foreach (ISchemaClass entity in entitieslist)
- {
- childclass = SharpQueryTree.SchemaClassDict[entity.GetType().FullName];
- if ((childclass != null) && (childclass != ""))
- {
- ChildNode = (ISharpQueryNode)ass.CreateInstance(childclass, false, BindingFlags.CreateInstance, null, new object[] { entity }, null, null);
- if (ChildNode != null)
- {
- bool addNode = true;
-
- if (ChildNode is SharpQueryNodeNotSupported)
- {
- addNode = this.ShowUnsupported();
- }
-
- if (addNode == true)
- {
- this.Nodes.Add(ChildNode as TreeNode);
- ChildNode.Refresh();
- }
- }
- }
- }
- }
- }
- }
- }
-
- protected bool ShowUnsupported()
- {
- // AddInTreeNode AddinNode;
- bool ret = true;
-
- // AddinNode = AddInTree.GetTreeNode("/SharpQuery/Connection");
- // foreach ( DictionaryEntry entryChild in AddinNode.ChildNodes)
- // {
- // AddInTreeNode ChildNode = entryChild.Value as AddInTreeNode;
- // if ( ChildNode != null )
- // {
- // SharpQueryConnectionCodon codon = ChildNode.Codon as SharpQueryConnectionCodon;
- // if ( codon != null )
- // {
- // if ( codon.Node == this.GetType().FullName )
- // {
- // ret = bool.Parse( codon.ShowUnsuported );
- // }
- // }
- // }
- // }
-
- return ret;
- }
-
- }
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/ISharpQueryNode.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/ISharpQueryNode.cs
deleted file mode 100644
index 6ebe8d4d9e..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/ISharpQueryNode.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using SharpQuery.Collections;
-using SharpQuery.Connection;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Gui.TreeView
-{
- public interface ISharpQueryNode
- {
- ///
- /// Path to a string #develop menu command object.
- /// You should add this extension path in the addin file.
- ///
- string AddinContextMenu { get; }
-
- ///
- /// His schema class from wich to displayed data informations.
- ///
- ISchemaClass SchemaClass { get; }
-
- ///
- /// the SchemaClass's connection.
- ///
- IConnection Connection { get; }
-
- ///
- /// Those, are list of the childs schema.( columns, etc etc )
- /// i am using a dictionnary because is more simplest to write
- /// Entities["PROCEDURES"] than Entities[0].
- ///
- SharpQueryListDictionary Entities { get; }
-
-
- ///
- /// Calls the Clear() method.
- /// Calls the Refresh() method of his SchemaClass member.
- /// Calls the BuildsChild() method.
- ///
- void Refresh();
-
- ///
- /// Calls the Clear() method of each child nodes.
- /// Calls the Clear() methode of his SchemaClass member.
- /// Remove each child nodes.
- ///
- void Clear();
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- ///
- void Execute(int rows);
-
- ///
- /// Builds childs ISharpQueryNode
- ///
- void BuildsChilds();
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SQLParameterInput.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SQLParameterInput.cs
deleted file mode 100644
index 14d7eba087..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SQLParameterInput.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Data;
-using System.Windows.Forms;
-
-using ICSharpCode.Core;
-using ICSharpCode.SharpDevelop.Gui.XmlForms;
-using SharpQuery.Collections;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Gui.DataView
-{
- public class SQLParameterInput : XmlForm
- {
- private DataGrid _dataGrid = null;
-
- public DataGrid dataGrid
- {
- get
- {
- if (this._dataGrid == null)
- {
- this._dataGrid = this.ControlDictionary["dataGrid"] as DataGrid;
- }
- return this._dataGrid;
- }
- }
-
- private void ResetClick(object sender, EventArgs e)
- {
-
- }
-
- protected void FillParameters(SharpQueryParameterCollection parameters)
- {
- SharpQueryParameter par = null;
- for (int i = 0; i < parameters.Count; i++)
- {
- par = parameters[i];
- if (par.Type == ParameterDirection.ReturnValue)
- {
- i--;
- parameters.Remove(par);
- }
- }
- this.dataGrid.CaptionVisible = true;
- this.dataGrid.DataSource = parameters;
- this.dataGrid.DataMember = null;
- this.dataGrid.AllowNavigation = false;
- }
-
- public SQLParameterInput()
- {
- SetupFromXmlResource(PropertyService.DataDirectory + @"\resources\dialogs\SharpQuery\SqlParametersInput.xfrm");
- }
-
- public SQLParameterInput(SharpQueryParameterCollection parameters)
- : this()
- {
- this.FillParameters(parameters);
- }
-
- protected override void SetupXmlLoader()
- {
- xmlLoader.StringValueFilter = new SharpDevelopStringValueFilter();
- xmlLoader.PropertyValueCreator = new SharpDevelopPropertyValueCreator();
- }
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryDataView.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryDataView.cs
deleted file mode 100644
index cf89947a47..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryDataView.cs
+++ /dev/null
@@ -1,233 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Data;
-using System.Windows.Forms;
-
-using ICSharpCode.SharpDevelop.Gui;
-using SharpQuery.Collections;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Gui.DataView
-{
- ///
- /// Description of the view content
- ///
- public class SharpQueryDataView : AbstractViewContent
- {
- DataGrid pDataGrid;
- ISchemaClass pSchema;
-
- #region AbstractViewContent requirements
- ///
- /// The representing the view
- ///
- ///
- public override object Control
- {
- get
- {
- return pDataGrid;
- }
- }
-
- ///
- /// Creates a new MyView object
- ///
- public SharpQueryDataView(ISchemaClass entity, int lines, SharpQuerySchemaClassCollection parameters)
- {
- if (entity == null)
- {
- throw new ArgumentNullException("entity");
- }
-
- TitleName = SharpQuery.SchemaClass.AbstractSharpQuerySchemaClass.RemoveBracket(entity.NormalizedName);
-
- this.pDataGrid = new DataGrid();
- this.pDataGrid.CaptionVisible = true;
- this.pDataGrid.DataMember = "";
- this.pDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pDataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
- this.pDataGrid.Location = new System.Drawing.Point(0, 0);
- this.pDataGrid.Name = "dataGrid";
- this.pDataGrid.Size = new System.Drawing.Size(292, 266);
- this.pDataGrid.TabIndex = 0;
- this.Schema = entity;
- this.Datatable = this.Schema.Execute(lines, parameters);
- // if ( this.Datatable == null )
- // {
- // WorkbenchSingleton.Workbench.ViewContentCollection.Remove( this );
- // }
- }
-
- ///
- /// Loads a new file into MyView
- ///
- public override void Load(ICSharpCode.SharpDevelop.OpenedFile file, System.IO.Stream stream)
- {
- throw new System.NotImplementedException();
- //base.Load(file, stream);
- }
-// public override void Load(string fileName)
-// {
-// // TODO
-// throw new System.NotImplementedException();
-// }
-
- ///
- /// Cleans up all used resources
- ///
- public override void Dispose()
- {
- // TODO: Clean up resources in this method
- pDataGrid.Dispose();
- }
- #endregion
-
- public ISchemaClass Schema
- {
- get
- {
- return this.pSchema;
- }
- set
- {
- this.pSchema = value;
- }
- }
-
- ///
- /// DataTable to display in the
- /// DataGrid
- ///
- public object Datatable
- {
- get
- {
- return this.pDataGrid.DataSource;
- }
-
- set
- {
- removeChangedHandler();
-
- this.pDataGrid.DataSource = value;
- this.pDataGrid.DataMember = null;
- this.pDataGrid.AllowNavigation = true;
-
- DataSet dataset = this.pDataGrid.DataSource as DataSet;
-
- if (dataset != null)
- {
- if (dataset.Tables.Count == 1)
- {
- this.pDataGrid.DataMember = dataset.Tables[0].TableName;
- this.pDataGrid.AllowNavigation = false;
- }
- }
-
- addChangedHandler();
- }
- }
-
- private void removeChangedHandler()
- {
- if (this.pDataGrid.DataSource != null)
- {
- DataSet dataset = this.pDataGrid.DataSource as DataSet;
-
- if (dataset != null)
- {
- foreach (DataTable table in dataset.Tables)
- {
- table.RowChanged -= new DataRowChangeEventHandler(this.UpdateTable);
- table.RowDeleted -= new DataRowChangeEventHandler(this.DeleteRow);
- }
- }
- else
- {
- (this.pDataGrid.DataSource as DataTable).RowChanged -= new DataRowChangeEventHandler(this.UpdateTable);
- (this.pDataGrid.DataSource as DataTable).RowDeleted -= new DataRowChangeEventHandler(this.DeleteRow);
- }
- }
- }
-
- private void addChangedHandler()
- {
- if (this.pDataGrid.DataSource != null)
- {
- DataSet dataset = this.pDataGrid.DataSource as DataSet;
-
- if (dataset != null)
- {
- foreach (DataTable table in dataset.Tables)
- {
- table.RowChanged += new DataRowChangeEventHandler(this.UpdateTable);
- table.RowDeleted += new DataRowChangeEventHandler(this.DeleteRow);
- }
- }
- else
- {
- (this.pDataGrid.DataSource as DataTable).RowChanged += new DataRowChangeEventHandler(this.UpdateTable);
- (this.pDataGrid.DataSource as DataTable).RowDeleted += new DataRowChangeEventHandler(this.DeleteRow);
- }
- }
- }
-
- public void UpdateTable(object sender, DataRowChangeEventArgs e)
- {
- if (Datatable != null)
- {
- switch (e.Action)
- {
- case DataRowAction.Add:
- this.Schema.Connection.InsertRow(this.Schema, e.Row);
- break;
- case DataRowAction.Change:
- this.Schema.Connection.UpDateRow(this.Schema, e.Row);
- break;
- }
- }
- }
-
- public void DeleteRow(object sender, DataRowChangeEventArgs e)
- {
- switch (e.Action)
- {
- case DataRowAction.Delete:
- this.Schema.Connection.DeleteRow(this.Schema, e.Row);
- break;
- }
-
- }
-
- public override void Save(ICSharpCode.SharpDevelop.OpenedFile file, System.IO.Stream stream)
- {
- throw new System.NotImplementedException();
- //base.Save(file, stream);
- }
- /*
- public override void Save(string fileName)
- {
- DataSet dataset = this.pDataGrid.DataSource as DataSet;
- if (dataset == null)
- {
- DataTable dataTable = this.pDataGrid.DataSource as DataTable;
- if (dataTable != null)
- {
- dataset = new DataSet();
- dataset.Tables.Add(dataTable);
- }
- }
-
- dataset.WriteXml(fileName);
- }
- */
- }
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryPad.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryPad.cs
deleted file mode 100644
index e5a539dcee..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryPad.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Windows.Forms;
-using ICSharpCode.SharpDevelop.Gui;
-using SharpQuery.Gui.TreeView;
-
-//TODO : dans les SharpQueryList faire correspondre les restrictions vec les objets ajoutés
-//TODO : dans les SharpQueryList faire correspondre les dataconnection avec les objets ajoutés
-//TODO : ajout statistiques.
-
-namespace SharpQuery.Pads
-{
- ///
- /// This Pad Show a tree where you can add/remove databases connections.
- /// You can administrate databases from this tree.
- ///
- public class SharpQueryPad : AbstractPadContent
- {
- private static SharpQueryTree sharpQueryTree = null;
- #region AbstractPadContent requirements
- ///
- /// The representing the pad
- ///
- public override object Control
- {
- get
- {
- return sharpQueryTree;
- }
- }
-
- ///
- /// Creates a new SharpQueryPad object
- ///
- public SharpQueryPad()
- {
- CreateDefaultSharpQuery();
- sharpQueryTree.Dock = DockStyle.Fill;
- }
-
- void CreateDefaultSharpQuery()
- {
- sharpQueryTree = new SharpQueryTree();
- }
-
- public void SaveSharpQueryView()
- {
- }
-
- ///
- /// Cleans up all used resources
- ///
- public override void Dispose()
- {
- this.SaveSharpQueryView();
- sharpQueryTree.Dispose();
- }
- #endregion
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryDataNodes.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryDataNodes.cs
deleted file mode 100644
index 4a9db5af4d..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryDataNodes.cs
+++ /dev/null
@@ -1,255 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.ComponentModel;
-using System.Windows.Forms;
-
-using ICSharpCode.SharpDevelop.Gui;
-using SharpQuery.Collections;
-using SharpQuery.Gui.DataView;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Gui.TreeView
-{
- ///
- /// Column Node
- ///
- public class SharpQueryNodeColumn : AbstractSharpQueryNode
- {
- /// force to displayed a "+" for the node
- protected override bool NullChildAllowed
- {
- get
- {
- return false;
- }
- }
-
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/Column";
- }
- }
-
- public SharpQueryNodeColumn(SharpQueryColumn sharpQueryColumn)
- : base(sharpQueryColumn)
- {
- this.ImageIndex = 9;
- this.SelectedImageIndex = 9;
- }
- }
-
- ///
- /// Parameter Node
- ///
- public class SharpQueryNodeParameter : AbstractSharpQueryNode
- {
-
- /// force to displayed a "+" for the node
- protected override bool NullChildAllowed
- {
- get
- {
- return false;
- }
- }
-
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/Parameter";
- }
- }
-
- public SharpQueryNodeParameter(SharpQueryParameter sharpQueryParameter)
- : base(sharpQueryParameter)
- {
- this.ImageIndex = 9;
- this.SelectedImageIndex = 9;
- }
- }
-
- ///
- /// Table Node
- ///
- public class SharpQueryNodeTable : AbstractSharpQueryNode
- {
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/Table";
- }
- }
-
- public SharpQueryNodeTable(SharpQueryTable sharpQueryTable)
- : base(sharpQueryTable)
- {
- this.ImageIndex = 6;
- this.SelectedImageIndex = 6;
- }
- }
-
- ///
- /// View Node
- ///
- public class SharpQueryNodeView : AbstractSharpQueryNode
- {
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/View";
- }
- }
-
- public SharpQueryNodeView(SharpQueryView sharpQueryView)
- : base(sharpQueryView)
- {
- this.ImageIndex = 7;
- this.SelectedImageIndex = 7;
- }
- }
-
- ///
- /// Procedure Node
- ///
- public class SharpQueryNodeProcedure : AbstractSharpQueryNode
- {
-
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/Procedure";
- }
- }
-
- public SharpQueryNodeProcedure(SharpQueryProcedure sharpQueryProcedure)
- : base(sharpQueryProcedure)
- {
- this.ImageIndex = 8;
- this.SelectedImageIndex = 8;
- }
-
- ///
- /// allow the user to add some parameters while executing an SQL command
- ///
- protected override SharpQuerySchemaClassCollection OnExecute(CancelEventArgs e)
- {
- SharpQuerySchemaClassCollection tmp = this.SchemaClass.GetSchemaParameters();
- SharpQueryParameterCollection parameters = null;
- SharpQuerySchemaClassCollection returnValue = null;
-
- if (tmp.Count == 1 && tmp[0] is SharpQueryNotSupported)
- {
- parameters = new SharpQueryParameterCollection();
- }
- else
- {
- parameters = new SharpQueryParameterCollection();
- foreach (SharpQueryParameter par in tmp)
- parameters.Add(par);
- }
-
- if (parameters != null && parameters.Count > 0)
- {
- inputform = new SQLParameterInput(parameters);
- inputform.Owner = (Form)WorkbenchSingleton.Workbench;
-
- if (inputform.ShowDialog() != DialogResult.OK)
- {
- returnValue = null;
- e.Cancel = true;
- }
- else
- {
- returnValue = new SharpQuerySchemaClassCollection();
- foreach (SharpQueryParameter par in parameters)
- {
- returnValue.Add(par);
- }
- }
- }
-
- return returnValue;
- }
- }
-
- ///
- /// Node displayed when a function is not supported by the provider!
- ///
- public class SharpQueryNodeNotSupported : AbstractSharpQueryNode
- {
-
- /// force to displayed a "+" for the node
- protected override bool NullChildAllowed
- {
- get
- {
- return false;
- }
- }
-
- public SharpQueryNodeNotSupported(SharpQueryNotSupported sharpQueryNotSupported)
- : base(sharpQueryNotSupported)
- {
- this.ImageIndex = 10;
- this.SelectedImageIndex = 10;
- }
- }
-
-
- ///
- /// Schema Node
- ///
- public class SharpQueryNodeSchema : AbstractSharpQueryNode
- {
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/Schema";
- }
- }
-
- public SharpQueryNodeSchema(SharpQuerySchema schema)
- : base(schema)
- {
- this.ImageIndex = 1;
- this.SelectedImageIndex = 1;
- }
-
- }
-
- ///
- /// Catalog Node
- ///
- public class SharpQueryNodeCatalog : AbstractSharpQueryNode
- {
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/Catalog";
- }
- }
-
- public SharpQueryNodeCatalog(SharpQueryCatalog catalog)
- : base(catalog)
- {
- this.ImageIndex = 1;
- this.SelectedImageIndex = 1;
- }
- }
-
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryNodesRoot.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryNodesRoot.cs
deleted file mode 100644
index 55bce1b7de..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryNodesRoot.cs
+++ /dev/null
@@ -1,385 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-// created on 04/11/2003 at 17:29
-
-using System;
-using System.Reflection;
-using System.Windows.Forms;
-
-using ICSharpCode.Core;
-using SharpQuery.Collections;
-using SharpQuery.Connection;
-using SharpQuery.Exceptions;
-using SharpQuery.SchemaClass;
-
-namespace SharpQuery.Gui.TreeView
-{
- ///
- /// this is the root of all others nodes!
- ///
- public class SharpQueryNodeDatabaseRoot : AbstractSharpQueryNode
- {
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/DatabaseRoot";
- }
- }
-
- public override string entityName
- {
- get
- {
- return StringParser.Parse("${res:SharpQuery.Label.DataBasesRoot}");
- }
- }
-
- public SharpQueryNodeDatabaseRoot()
- : base(null)
- {
- this.Text = this.entityName;
-
- this.ImageIndex = 0;
- this.SelectedImageIndex = 0;
- }
-
- public override void Refresh()
- {
- this.Text = this.entityName;
-
- foreach (ISharpQueryNode node in this.Nodes)
- {
- node.Refresh();
- }
- }
-
- public override void Clear()
- {
- foreach (ISharpQueryNode node in this.Nodes)
- {
- node.Clear();
- }
- }
-
- public override void BuildsChilds()
- {
- IConnection connection = null;
- ISharpQueryNode node = null;
-
- try
- {
- connection = AbstractSharpQueryConnectionWrapper.CreateFromDataConnectionLink();
-
- if (connection != null)
- {
- string ChildClass = "";
-
- if (SharpQueryTree.SchemaClassDict.ContainsKey(connection.GetType().FullName) == true)
- {
- ChildClass = SharpQueryTree.SchemaClassDict[connection.GetType().FullName];
- }
-
- if ((ChildClass != null) && (ChildClass != ""))
- {
- node = (ISharpQueryNode)ass.CreateInstance(ChildClass, false, BindingFlags.CreateInstance, null, new object[] { connection }, null, null);
- }
- else
- {
- node = new SharpQueryNodeNotSupported(new SharpQueryNotSupported(connection, "", "", "", connection.GetType().FullName));
- }
-
-
- //TODO : do an interface for the node connection!
- (node as SharpQueryNodeConnection).Connect();
- this.Nodes.Add(node as TreeNode);
- node.Refresh();
-
- if (node.Connection.IsConnectionStringWrong == true)
- {
- this.Nodes.Remove(node as TreeNode);
- }
- else
- {
- this.Expand();
- }
- }
- }
- catch (ConnectionStringException e)
- {
- if (this.Nodes.Contains(node as TreeNode) == true)
- {
- this.Nodes.Remove(node as TreeNode);
- }
- MessageService.ShowError(e.Message);
- }
- }
- }
-
-
- ///
- /// Root nodes for a connection to a database
- ///
- public class SharpQueryNodeConnection : AbstractSharpQueryNode
- {
- IConnection pConnection = null;
-
- public override string entityNormalizedName
- {
- get
- {
- if (this.pConnection != null)
- {
- return this.pConnection.NormalizedName;
- }
- else
- {
- return "";
- }
- }
- }
-
- public override string entityName
- {
- get
- {
- if (this.pConnection != null)
- {
- return this.pConnection.Name;
- }
- else
- {
- return "";
- }
- }
- }
-
- public override IConnection Connection
- {
- get
- {
- if (this.pConnection != null)
- {
- return this.pConnection;
- }
- else
- {
- return null;
- }
- }
- }
-
- public override SharpQueryListDictionary Entities
- {
- get
- {
- if (this.Connection != null)
- {
- return this.Connection.Entities;
- }
- else
- {
- return null;
- }
- }
- }
-
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/DatabaseConnection";
- }
- }
-
- public SharpQueryNodeConnection(IConnection dataConnection)
- : base(null)
- {
- this.pConnection = dataConnection;
- this.ImageIndex = 1;
- this.SelectedImageIndex = 1;
- }
-
- public bool IsConnected
- {
- get
- {
- return this.Connection.IsOpen;
- }
- }
-
- public void Disconnect()
- {
- if (this.IsConnected == true)
- {
- this.Collapse();
- this.Clear();
- this.Connection.Close();
- this.ImageIndex = 1;
- this.SelectedImageIndex = 1;
- }
- }
-
- public void Connect()
- {
- try
- {
- if (this.IsConnected == false)
- {
- if (this.Connection.Open())
- {
- this.Refresh();
- this.ImageIndex = 2;
- this.SelectedImageIndex = 2;
- }
- }
- }
- catch (OpenConnectionException e)
- {
- MessageService.ShowError(e.Message);
- }
- }
-
- protected override void OnRefresh()
- {
- if (this.IsConnected == true)
- {
- this.Clear();
- this.Connection.Refresh();
- }
- }
-
- public override void Clear()
- {
- if (this.Connection != null)
- {
- this.Connection.Clear();
- }
-
- base.Clear();
- }
-
- public void RemoveConnection()
- {
- this.Disconnect();
- this.pConnection = null;
-
- this.Parent.Nodes.Remove(this);
- }
-
- public void ModifyConnection()
- {
- IConnection Oldconnection = this.pConnection;
- bool error = false;
- try
- {
- IConnection connection = null;
-
- connection = AbstractSharpQueryConnectionWrapper.UpDateFromDataConnectionLink(this.Connection);
-
- if (connection != null)
- {
- this.Disconnect();
- this.pConnection = connection;
- this.Refresh();
- error = this.pConnection.IsConnectionStringWrong;
- }
- }
- catch (ConnectionStringException e)
- {
- error = true;
- MessageService.ShowError(e.Message);
- }
- finally
- {
- if (error == true)
- {
- this.pConnection = Oldconnection;
- this.Connect();
- this.Refresh();
- }
- }
- }
- }
-
-
- ///
- /// Tables Root Node
- ///
- public class SharpQueryNodeTableRoot : AbstractSharpQueryNode
- {
- ///
- /// Addin Path of the node's context menu
- ///
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/TablesRoot";
- }
- }
-
- public SharpQueryNodeTableRoot(AbstractSharpQuerySchemaClass databaseclass)
- : base(databaseclass)
- {
- this.ImageIndex = 3;
- this.SelectedImageIndex = 3;
- }
-
- }
-
- ///
- /// Views Root Node
- ///
- public class SharpQueryNodeViewRoot : AbstractSharpQueryNode
- {
- ///
- /// Addin Path of the node's context menu
- ///
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/ViewsRoot";
- }
- }
-
- public SharpQueryNodeViewRoot(AbstractSharpQuerySchemaClass databaseclass)
- : base(databaseclass)
- {
- this.ImageIndex = 4;
- this.SelectedImageIndex = 4;
- }
- }
-
- ///
- /// Procedure Root Node
- ///
- public class SharpQueryNodeProcedureRoot : AbstractSharpQueryNode
- {
- ///
- /// Addin Path of the node's context menu
- ///
- public override string AddinContextMenu
- {
- get
- {
- return "/SharpQuery/ContextMenu/ProceduresRoot";
- }
- }
-
- public SharpQueryNodeProcedureRoot(AbstractSharpQuerySchemaClass databaseclass)
- : base(databaseclass)
- {
- this.ImageIndex = 5;
- this.SelectedImageIndex = 5;
- }
- }
-
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryTree.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryTree.cs
deleted file mode 100644
index 816890f220..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/GUI/SharpQueryTree/SharpQueryTree.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-// created on 04/11/2003 at 16:05
-using ICSharpCode.Core.WinForms;
-using System;
-using System.Windows.Forms;
-using ICSharpCode.Core;
-using ICSharpCode.SharpDevelop;
-using SharpQuery.Collections;
-
-namespace SharpQuery.Gui.TreeView
-{
- ///
- /// This class shows all databases connections in a treeview.
- ///
- public class SharpQueryTree : System.Windows.Forms.TreeView
- {
- private System.Windows.Forms.ImageList pNodeImages;
-
- public static SharpQueryStringDictionary SchemaClassDict;
-
- ///
- /// Create a SharpQueryTree objec
- ///
- public SharpQueryTree()
- : base()
- {
- this.pNodeImages = new ImageList();
- this.pNodeImages.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit;
- this.pNodeImages.ImageSize = new System.Drawing.Size(16, 16);
- this.pNodeImages.TransparentColor = System.Drawing.Color.DarkCyan;
-
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.DataBaseRoot"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.DatabaseConnectionClose"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.DatabaseConnection"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.TablesRoot"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.ViewsRoot"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.ProceduresRoot"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.Table"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.View"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.Procedure"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.Column"));
- this.pNodeImages.Images.Add(IconService.GetBitmap("Icons.16x16.SharpQuery.NodeError"));
-
- this.ImageList = this.pNodeImages;
-
- SchemaClassDict = new SharpQueryStringDictionary();
-
- LoadSharpQueryConnectionCodon();
-
- //Add the Root Node.
- this.Nodes.Add(new SharpQueryNodeDatabaseRoot());
- }
-
- protected void LoadSharpQueryConnectionCodon()
- {
- AddInTreeNode AddinNode = AddInTree.GetTreeNode("/SharpQuery/Connection");
- LoggingService.Info("Building SharpQuery Codons...");
- foreach (Codon c in AddinNode.Codons)
- {
- if (c.Properties["schema"] != null && c.Properties["schema"] != string.Empty)
- {
- if (SchemaClassDict.ContainsKey(c.Properties["schema"]))
- {
- SchemaClassDict[c.Properties["schema"]] = c.Properties["node"];
- }
- else
- {
- SchemaClassDict.Add(c.Properties["schema"], c.Properties["node"]);
- }
- }
- }
- }
-
- ///
- /// Select the node under the mouse cursor
- ///
- protected override void OnMouseDown(MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right || e.Button == MouseButtons.Left)
- {
- this.SelectedNode = this.GetNodeAt(e.X, e.Y);
- }
-
-
- base.OnMouseDown(e);
- }
-
- ///
- /// Display the context menu associated with a node type
- ///
- protected override void OnMouseUp(MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right && this.SelectedNode != null && SelectedNode is ISharpQueryNode)
- {
- ISharpQueryNode selectedBrowserNode = SelectedNode as ISharpQueryNode;
- if (selectedBrowserNode.AddinContextMenu != "")
- {
- MenuService.ShowContextMenu(this, selectedBrowserNode.AddinContextMenu, this, e.X, e.Y);
- }
- }
-
- base.OnMouseUp(e);
- }
-
- protected override void OnItemDrag(ItemDragEventArgs e)
- {
- base.OnItemDrag(e);
- AbstractSharpQueryNode node = e.Item as AbstractSharpQueryNode;
- if (node != null)
- {
- DataObject dataObject = null;
-
- if (node.SchemaClass != null)
- {
- dataObject = node.SchemaClass.DragObject;
-
- if (dataObject != null)
- {
- dataObject.SetData(node.GetType(), node);
- DoDragDrop(dataObject, DragDropEffects.All);
- }
- }
- }
- }
-
- protected override void OnBeforeExpand(TreeViewCancelEventArgs e)
- {
- SharpQueryNodeConnection node = e.Node as SharpQueryNodeConnection;
-
- if (node != null)
- {
- if (node.IsConnected == false)
- {
- node.Connect();
- }
- }
-
- base.OnBeforeExpand(e);
- }
-
-
- protected override void OnAfterExpand(TreeViewEventArgs e)
- {
- ISharpQueryNode node = e.Node as ISharpQueryNode;
-
- if (node != null)
- {
- node.Refresh();
- }
-
- base.OnAfterExpand(e);
- }
-
- protected override void OnAfterCollapse(TreeViewEventArgs e)
- {
- ISharpQueryNode node = e.Node as ISharpQueryNode;
-
- if (node != null)
- {
- node.Clear();
- }
-
- base.OnAfterCollapse(e);
- }
- }
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/ISchemaClass.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/ISchemaClass.cs
deleted file mode 100644
index d0e8a45656..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/ISchemaClass.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System.Windows.Forms;
-using SharpQuery.Collections;
-using SharpQuery.Connection;
-
-namespace SharpQuery.SchemaClass
-{
- ///
- /// This interface is used by any schema class in sharp query.
- /// A schema class is a class that is the database definition of a table,
- /// a view, a column, etc etc ...
- ///
- /// entity is table, a view or other database struct.
- /// schema's names are displayed between [ and ]
- ///
- ///
- public interface ISchemaClass
- {
- ///
- /// get the connection object
- ///
- IConnection Connection { get; }
-
- ///
- /// get the entity's catalog name.
- ///
- string CatalogName { get; }
-
- ///
- /// get the entity's schema name.
- ///
- string SchemaName { get; }
-
- ///
- /// Get the entity's owner name
- ///
- /// for exemple, the owner of a column is a table,
- /// and this property return the name of the table
- ///
- ///
- string OwnerName { get; }
-
- ///
- /// get the entity's name
- ///
- string Name { get; }
-
- ///
- /// Internal name, used internally
- ///
- string InternalName { get; }
-
- ///
- /// entity's normalized name.
- ///
- /// there are a database test. In this database there are a schema
- /// named fool. In this schema there are a table named fooltable
- /// and a in this table there are a column named foolcolumn.
- /// So, the normalized name of the schema is test.[fool].
- /// The normalized name of the table is test.[fool].fooltable.
- /// The normalized name of the column is test.[fool].fooltable.foolcolumn.
- ///
- ///
- string NormalizedName { get; }
-
- ///
- /// Those, are list of the childs schema.( columns, etc etc )
- /// i am using a dictionnary because is more simplest to write
- /// Entities["PROCEDURES"] than Entities[0].
- ///
- SharpQueryListDictionary Entities { get; }
-
- /// return a DataObject
- DataObject DragObject { get; }
-
- ///
- /// Refresh child schemas from the database.
- ///
- void Refresh();
-
- ///
- /// Erase all child schemas
- ///
- void Clear();
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- object Execute(int rows, SharpQuerySchemaClassCollection parameters);
-
- ///
- /// Get 's catalogs.
- ///
- SharpQuerySchemaClassCollection GetSchemaCatalogs();
-
- ///
- /// Get 's Schemas.
- ///
- SharpQuerySchemaClassCollection GetSchemaSchemas();
-
- ///
- /// From a catalog object, get tables from all schemas.
- /// From a schema object get tables from all this schema.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaTables();
-
- ///
- /// From a catalog object, get views from all schemas.
- /// From a schema object get views from all this schema.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaViews();
-
- ///
- /// From a catalog object, get procedures from all schemas.
- /// From a schema object get procedures from all this schema.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaProcedures();
-
- ///
- /// From a table or a view or procedure object, get columns from the table.
- /// From other object, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaColumns();
-
- ///
- /// Get parameters from the procedure.
- /// If parameters are not supported by the schema, return an empty list.
- ///
- SharpQuerySchemaClassCollection GetSchemaParameters();
- }
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/SharpQueryCommands.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/SharpQueryCommands.cs
deleted file mode 100644
index ada0de3fd7..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/SharpQueryCommands.cs
+++ /dev/null
@@ -1,197 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using SharpQuery.Gui.TreeView;
-
-namespace SharpQuery.Commands
-{
- public class SharpQueryRefreshCommand : AbstractSharpQueryCommand
- {
- public override bool IsEnabled
- {
- get
- {
- return base.IsEnabled && (this.sharpQueryNode is AbstractSharpQueryNode)
- && (this.sharpQueryNode as AbstractSharpQueryNode).Connection != null
- && (this.sharpQueryNode as AbstractSharpQueryNode).Connection.IsOpen == true;
- }
- set { }
- }
- ///
- /// Refresh the selected node of the SharpQuery Tree.
- ///
- public override void Run()
- {
- (this.sharpQueryNode as ISharpQueryNode).Refresh();
- }
- }
-
- ///
- /// Add a connection to a database server into the
- ///
- public class SharpQueryAddconnectionCommand : AbstractSharpQueryCommand
- {
-
- public override bool IsEnabled
- {
- get
- {
- return base.IsEnabled && (this.sharpQueryNode is SharpQueryNodeDatabaseRoot);
- }
- set { }
- }
-
- ///
- /// Add a connection to a database server into the
- ///
- public override void Run()
- {
- try {
- (this.sharpQueryNode as SharpQueryNodeDatabaseRoot).BuildsChilds();
- } catch (System.IO.FileNotFoundException ex) {
- if (ex.ToString().Contains("ADODB")) {
- ICSharpCode.Core.MessageService.ShowError("ADODB is not installed on your computer.\n" +
- "Please install the .NET Framework SDK; or install " +
- "the ADODB assembly into the GAC.");
- } else {
- throw;
- }
- }
- }
- }
-
- ///
- /// Remove a connection from a database server into the
- ///
- public class SharpQueryRemoveConnectionCommand : AbstractSharpQueryCommand
- {
- public override bool IsEnabled
- {
- get
- {
- return base.IsEnabled && (this.sharpQueryNode is SharpQueryNodeConnection);
- }
- set { }
- }
-
- ///
- /// Remove a connection from a database server into the
- ///
- public override void Run()
- {
- (this.sharpQueryNode as SharpQueryNodeConnection).RemoveConnection();
- }
- }
-
-
- ///
- /// Remove a connection from a database server into the
- ///
- public class SharpQueryModifyConnectionCommand : AbstractSharpQueryCommand
- {
-
- public override bool IsEnabled
- {
- get
- {
- return base.IsEnabled && (this.sharpQueryNode is SharpQueryNodeConnection);
- }
- set { }
- }
-
- ///
- /// Remove a connection from a database server into the
- ///
- public override void Run()
- {
- (this.sharpQueryNode as SharpQueryNodeConnection).ModifyConnection();
- }
- }
-
- ///
- /// Disconnect From a database server
- ///
- public class SharpQueryDisconnectCommand : AbstractSharpQueryCommand
- {
-
- public override bool IsEnabled
- {
- get
- {
- return base.IsEnabled && (this.sharpQueryNode is SharpQueryNodeConnection)
- && (this.sharpQueryNode as SharpQueryNodeConnection).IsConnected == true;
- }
- set { }
- }
-
- public SharpQueryDisconnectCommand()
- : base()
- {
- }
-
- ///
- /// Disconnect From a database server
- ///
- public override void Run()
- {
- (this.sharpQueryNode as SharpQueryNodeConnection).Disconnect();
- }
- }
-
- ///
- /// Disconnect From a database server
- ///
- public class SharpQueryConnectCommand : AbstractSharpQueryCommand
- {
-
- public override bool IsEnabled
- {
- get
- {
- return base.IsEnabled && (this.sharpQueryNode is SharpQueryNodeConnection)
- && (this.sharpQueryNode as SharpQueryNodeConnection).IsConnected == false;
- }
- set { }
- }
-
- public SharpQueryConnectCommand()
- : base()
- {
- }
-
- ///
- /// Disconnect From a database server
- ///
- public override void Run()
- {
- (this.sharpQueryNode as SharpQueryNodeConnection).Connect();
- }
- }
-
-
- ///
- /// Disconnect From a database server
- ///
- public class SharpQueryExecuteCommand : AbstractSharpQueryCommand
- {
- public SharpQueryExecuteCommand()
- : base()
- {
- }
-
- ///
- /// Disconnect From a database server
- ///
- public override void Run()
- {
- this.sharpQueryNode.Execute(0);
- }
- }
-
-
-}
diff --git a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/SharpQuerySchemaClass.cs b/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/SharpQuerySchemaClass.cs
deleted file mode 100644
index 14b8161d17..0000000000
--- a/src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/SharpQuery/SharpQuerySchemaClass.cs
+++ /dev/null
@@ -1,796 +0,0 @@
-//
-//
-//
-//
-// $Revision$
-//
-
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Windows.Forms;
-
-using ICSharpCode.Core;
-using SharpQuery.Collections;
-using SharpQuery.Connection;
-
-namespace SharpQuery.SchemaClass
-{
- //
- // Children
- //
-
- ///
- /// Column class
- ///
- public class SharpQueryColumn : AbstractSharpQuerySchemaClass
- {
- public override string NormalizedName
- {
- get
- {
- string normalizedName = "";
-
- if ((this.OwnerName != "") && (this.OwnerName != null))
- {
- normalizedName += this.OwnerName + ".";
- }
-
- normalizedName += this.Name;
-
- return normalizedName;
- }
- }
-
- protected override void CreateEntitiesList()
- {
- }
-
- public SharpQueryColumn(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- }
-
- protected override void OnRefresh()
- {
- //nothing !
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- //nothing
- return null;
- }
-
- /// return a DataObject
- ///
- public override DataObject DragObject
- {
- get
- {
- DataObject returnValue = new DataObject();
- string extract = this.NormalizedName;
- returnValue.SetData(typeof(string), extract);
- return returnValue;
- }
- }
- }
-
- ///
- /// Procedurre's parameters class
- ///
- public class SharpQueryParameter : AbstractSharpQuerySchemaClass
- {
- private DbType _dataType;
- private object _value = null;
- private ParameterDirection _type;
-
- ///
- /// Data Type of the parameter
- /// ( used only while extracting data or executing procedure )
- ///
- public DbType DataType
- {
- get
- {
- return this._dataType;
- }
- set
- {
- this._dataType = value;
- switch (value)
- {
- //string type
- case DbType.AnsiString:
- case DbType.AnsiStringFixedLength:
- case DbType.String:
- case DbType.StringFixedLength: this._value = new string((char[])null); break;
- //array type
- case DbType.Binary: this._value = new byte[8000]; break;
- //bool type
- case DbType.Boolean: this._value = new bool(); break;
- //interger type
- case DbType.SByte: this._value = new sbyte(); break;
- case DbType.Byte: this._value = new byte(); break;
- case DbType.Int16: this._value = new short(); break;
- case DbType.Int32: this._value = new int(); break;
- case DbType.Int64: this._value = new long(); break;
- case DbType.UInt16: this._value = new ushort(); break;
- case DbType.UInt32: this._value = new uint(); break;
- case DbType.UInt64: this._value = new long(); break;
- //Date type
- case DbType.Date:
- case DbType.DateTime:
- case DbType.Time: this._value = new DateTime(); break;
- //float type
- case DbType.Decimal: this._value = new decimal(); break;
- case DbType.Currency:
- case DbType.VarNumeric:
- case DbType.Double: this._value = new double(); break;
- case DbType.Single: this._value = new float(); break;
- //user defined
- case DbType.Object: this._value = new object(); break;
- //Guid
- case DbType.Guid: this._value = new Guid(); break;
- default: throw new ArgumentOutOfRangeException("value");
- }
- }
- }
-
- protected void SetValue(string value)
- {
- switch (this.DataType)
- {
- //string type
- case DbType.Object:
- case DbType.Binary:
- case DbType.AnsiString:
- case DbType.AnsiStringFixedLength:
- case DbType.String:
- case DbType.StringFixedLength: this._value = value; break;
-
- case DbType.Boolean: this._value = bool.Parse(value); break;
-
- case DbType.SByte: this._value = sbyte.Parse(value); break;
- case DbType.Byte: this._value = byte.Parse(value); break;
- case DbType.Int16: this._value = short.Parse(value); break;
- case DbType.Int32: this._value = int.Parse(value); break;
- case DbType.Int64: this._value = long.Parse(value); break;
- case DbType.UInt16: this._value = ushort.Parse(value); break;
- case DbType.UInt32: this._value = uint.Parse(value); break;
- case DbType.UInt64: this._value = long.Parse(value); break;
-
- case DbType.Date:
- case DbType.DateTime:
- case DbType.Time: this._value = DateTime.Parse(value); break;
-
- case DbType.Decimal: this._value = decimal.Parse(value); break;
- case DbType.Currency:
- case DbType.VarNumeric:
- case DbType.Double: this._value = double.Parse(value); break;
- case DbType.Single: this._value = float.Parse(value); break;
-
- case DbType.Guid: this._value = new Guid(value); break;
- default: throw new ArgumentOutOfRangeException("value");
- }
- }
-
- ///
- /// Value of the parameter
- /// ( used only while extracting data or executing procedure )
- ///
- public object Value
- {
- get
- {
- return this._value;
- }
- set
- {
- this.SetValue(value.ToString());
- }
- }
-
- ///
- /// Value of the parameter
- /// ( used only while extracting data or executing procedure )
- ///
- public ParameterDirection Type
- {
- get
- {
- return this._type;
- }
- set
- {
- this._type = value;
- }
- }
-
- public override string NormalizedName
- {
- get
- {
- string normalizedName = "";
-
- if ((this.OwnerName != "") && (this.OwnerName != null))
- {
- normalizedName += this.OwnerName + ".";
- }
-
- normalizedName += this.Name;
-
- return normalizedName;
- }
- }
-
- protected override void CreateEntitiesList()
- {
- }
-
- public SharpQueryParameter(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- this.pEntities = null;
- }
-
- protected override void OnRefresh()
- {
- //nothing !
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- //nothing
- return null;
- }
-
- /// return a DataObject
- ///
- public override DataObject DragObject
- {
- get
- {
- DataObject returnValue = new DataObject();
- string extract = NormalizedName;
- returnValue.SetData(typeof(string), extract);
- return returnValue;
- }
- }
- }
-
- ///
- /// Table class
- ///
- public class SharpQueryProcedure : AbstractSharpQuerySchemaClass
- {
- public override string NormalizedName
- {
- get
- {
- if ((this.CatalogName != "") && (this.CatalogName != null))
- {
- return this.CatalogName + "." + this.Name;
- }
- else
- {
- return CheckWhiteSpace(this.Connection.GetProperty(AbstractSharpQueryConnectionWrapper.SharpQueryPropertyEnum.DataSource).ToString()) + "." + this.Name;
- }
- }
- }
-
- protected override void CreateEntitiesList()
- {
- base.CreateEntitiesList();
- this.pEntities.Add("PROCEDURE_COLUMNS", new SharpQuerySchemaClassCollection());
- this.pEntities.Add("PROCEDURE_PARAMETERS", new SharpQuerySchemaClassCollection());
- }
-
- public SharpQueryProcedure(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- }
-
- public override SharpQuerySchemaClassCollection GetSchemaParameters()
- {
- return this.pDataConnection.GetSchemaProcedureParameters(this);
- }
-
- public override SharpQuerySchemaClassCollection GetSchemaColumns()
- {
- return this.pDataConnection.GetSchemaProcedureColumns(this);
- }
-
- protected override void OnRefresh()
- {
- this.Entities["PROCEDURE_COLUMNS"].AddRange(this.GetSchemaColumns());
- this.Entities["PROCEDURE_PARAMETERS"].AddRange(this.GetSchemaParameters());
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- return this.Connection.ExecuteProcedure(this, rows, parameters);
- }
-
- /// return a DataObject
- ///
- public override DataObject DragObject
- {
- get
- {
- DataObject returnValue = new DataObject();
- string extract = "EXECUTE " + NormalizedName;
- returnValue.SetData(typeof(string), extract);
- return returnValue;
- }
- }
- }
-
- ///
- /// Table class
- ///
- public class SharpQueryTable : AbstractSharpQuerySchemaClass
- {
- public override string NormalizedName
- {
- get
- {
- if ((this.CatalogName != "") && (this.CatalogName != null))
- {
- return this.CatalogName + "." + this.Name;
- }
- else
- {
- return CheckWhiteSpace(this.Connection.GetProperty(AbstractSharpQueryConnectionWrapper.SharpQueryPropertyEnum.DataSource).ToString()) + "." + this.Name;
- }
- }
- }
-
- protected override void CreateEntitiesList()
- {
- base.CreateEntitiesList();
- this.pEntities.Add("TABLE_COLUMNS", new SharpQuerySchemaClassCollection());
- }
-
- public SharpQueryTable(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- }
-
- public override SharpQuerySchemaClassCollection GetSchemaColumns()
- {
- return this.pDataConnection.GetSchemaTableColumns(this);
- }
-
- protected override void OnRefresh()
- {
- this.Entities["TABLE_COLUMNS"].AddRange(this.GetSchemaColumns());
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- return this.Connection.ExtractData(this, rows);
- }
-
- /// return a DataObject
- ///
- public override DataObject DragObject
- {
- get
- {
- string SQLSelect = "SELECT ";
- string SQLFrom = "FROM ";
-
- SharpQuerySchemaClassCollection entitieslist = null;
-
- SQLFrom += this.Name;
-
- this.Refresh();
-
- //we have only a table or view :o)
- foreach (KeyValuePair DicEntry in Entities)
- {
- entitieslist = DicEntry.Value as SharpQuerySchemaClassCollection;
- break;
- }
-
- if (entitieslist == null)
- {
- throw new System.ArgumentNullException("entitieslist");
- }
-
- foreach (ISchemaClass column in entitieslist)
- {
- SQLSelect += column.NormalizedName;
- SQLSelect += ",";
- }
-
- SQLSelect = SQLSelect.TrimEnd(new Char[] { ',' });
- SQLSelect += " ";
-
- DataObject returnValue = new DataObject();
-
- returnValue.SetData(typeof(string), SQLSelect + SQLFrom);
- return returnValue;
- }
- }
- }
-
- ///
- /// View class
- ///
- public class SharpQueryView : AbstractSharpQuerySchemaClass
- {
- public override string NormalizedName
- {
- get
- {
- if ((this.CatalogName != "") && (this.CatalogName != null))
- {
- return this.CatalogName + "." + this.Name;
- }
- else
- {
- return CheckWhiteSpace(this.Connection.GetProperty(AbstractSharpQueryConnectionWrapper.SharpQueryPropertyEnum.DataSource).ToString()) + "." + this.Name;
- }
- }
- }
-
- protected override void CreateEntitiesList()
- {
- base.CreateEntitiesList();
- this.pEntities.Add("VIEWS_COLUMNS", new SharpQuerySchemaClassCollection());
- }
-
- public SharpQueryView(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- }
-
- public override SharpQuerySchemaClassCollection GetSchemaColumns()
- {
- return this.pDataConnection.GetSchemaViewColumns(this);
- }
-
- protected override void OnRefresh()
- {
- this.Entities["VIEWS_COLUMNS"].AddRange(this.GetSchemaColumns());
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- return this.Connection.ExtractData(this, rows);
- }
-
- /// return a DataObject
- ///
- public override DataObject DragObject
- {
- get
- {
- string SQLSelect = "SELECT ";
- string SQLFrom = "FROM ";
-
- SharpQuerySchemaClassCollection entitieslist = null;
-
- SQLFrom += this.Name;
-
- this.Refresh();
-
- //we have only a table or view :o)
- foreach (KeyValuePair DicEntry in Entities)
- {
- entitieslist = DicEntry.Value as SharpQuerySchemaClassCollection;
- break;
- }
-
- if (entitieslist == null)
- {
- throw new System.ArgumentNullException("entitieslist");
- }
-
- foreach (ISchemaClass column in entitieslist)
- {
- SQLSelect += column.NormalizedName;
- SQLSelect += ",";
- }
-
- SQLSelect = SQLSelect.TrimEnd(new Char[] { ',' });
- SQLSelect += " ";
-
- DataObject returnValue = new DataObject();
-
- returnValue.SetData(typeof(string), SQLSelect + SQLFrom);
- return returnValue;
- }
- }
- }
-
- ///
- /// Class for unsupported functions
- ///
- public class SharpQueryNotSupported : AbstractSharpQuerySchemaClass
- {
- protected override void CreateEntitiesList()
- {
- }
-
- public SharpQueryNotSupported(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- this.pName += " " + StringParser.Parse("${res:SharpQuery.Error.NotSuported}") + " " + connection.Provider;
-
- }
-
- protected override void OnRefresh()
- {
- //nothing !
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- //nothing
- return null;
- }
- }
-
-
- ///
- /// Class lis of Tables
- ///
- public class SharpQueryTables : AbstractSharpQuerySchemaClass
- {
- protected override void CreateEntitiesList()
- {
- base.CreateEntitiesList();
- this.pEntities.Add("TABLES", new SharpQuerySchemaClassCollection());
- }
-
- public SharpQueryTables(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- this.pName = StringParser.Parse("${res:SharpQuery.Label.TablesRoot}");
- }
-
- protected override void OnRefresh()
- {
- this.Entities["TABLES"].AddRange(this.GetSchemaTables());
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- //nothing
- return null;
- }
- }
-
- ///
- /// Class lis of Views
- ///
- public class SharpQueryViews : AbstractSharpQuerySchemaClass
- {
-
- protected override void CreateEntitiesList()
- {
- base.CreateEntitiesList();
- this.pEntities.Add("VIEWS", new SharpQuerySchemaClassCollection());
- }
-
- public SharpQueryViews(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- this.pName = StringParser.Parse("${res:SharpQuery.Label.ViewsRoot}");
- }
-
- protected override void OnRefresh()
- {
- this.Entities["VIEWS"].AddRange(this.GetSchemaViews());
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- //nothing
- return null;
- }
- }
-
- ///
- /// Class lis of Procedures
- ///
- public class SharpQueryProcedures : AbstractSharpQuerySchemaClass
- {
- protected override void CreateEntitiesList()
- {
- base.CreateEntitiesList();
- this.pEntities.Add("PROCEDURES", new SharpQuerySchemaClassCollection());
- }
-
- public SharpQueryProcedures(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- this.pName = StringParser.Parse("${res:SharpQuery.Label.ProceduresRoot}");
- }
-
- protected override void OnRefresh()
- {
- this.Entities["PROCEDURES"].AddRange(this.GetSchemaProcedures());
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- //nothing
- return null;
- }
- }
-
- ///
- /// Class lis of Schemas
- ///
- public class SharpQuerySchema : AbstractSharpQuerySchemaClass
- {
- protected override void CreateEntitiesList()
- {
- base.CreateEntitiesList();
-
- SharpQuerySchemaClassCollection cl;
- cl = new SharpQuerySchemaClassCollection();
- cl.Add(new SharpQueryTables(this.pDataConnection, this.CatalogName, this.Name, "", ""));
- this.pEntities.Add("TABLES", cl);
-
- cl = new SharpQuerySchemaClassCollection();
- cl.Add(new SharpQueryViews(this.pDataConnection, this.CatalogName, this.Name, "", ""));
- this.pEntities.Add("VIEWS", cl);
-
- cl = new SharpQuerySchemaClassCollection();
- cl.Add(new SharpQueryProcedures(this.pDataConnection, this.CatalogName, this.Name, "", ""));
- this.pEntities.Add("PROCEDURES", cl);
- }
-
- public SharpQuerySchema(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- }
-
- protected override void OnRefresh()
- {
- // Nothing !
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- //nothing
- return null;
- }
-
- /// return a DataObject
- ///
- public override DataObject DragObject
- {
- get
- {
- DataObject returnValue = new DataObject();
- string extract = NormalizedName;
- returnValue.SetData(typeof(string), extract);
- return returnValue;
- }
- }
- }
-
- ///
- /// Class for a catalog
- ///
- public class SharpQueryCatalog : AbstractSharpQuerySchemaClass
- {
- protected override void CreateEntitiesList()
- {
- base.CreateEntitiesList();
- this.pEntities.Add("SCHEMAS", new SharpQuerySchemaClassCollection());
- }
-
- public SharpQueryCatalog(IConnection connection, string catalogName, string schemaName, string ownerName, string name)
- : base(connection, catalogName, schemaName, ownerName, name)
- {
- }
-
- protected override void OnRefresh()
- {
- this.Entities["SCHEMAS"].AddRange(this.GetSchemaSchemas());
- }
-
- ///
- /// For a Table or a View extract data.
- /// For a stocked procedure, execute it :o).
- /// Number of row to extract. if "0", extract all rows.
- /// DataTable
- /// or a DataSet
- ///
- public override object Execute(int rows, SharpQuerySchemaClassCollection parameters)
- {
- //nothing
- return null;
- }
-
- /// return a DataObject
- ///
- public override DataObject DragObject
- {
- get
- {
- DataObject returnValue = new DataObject();
- string extract = NormalizedName;
- returnValue.SetData(typeof(string), extract);
- return returnValue;
- }
- }
-
- }
-}