using System.Data;
using System.Data.Common;
using System.EnterpriseServices;
-#if NET_2_0
using System.Transactions;
-#endif
namespace System.Data.OleDb
{
[DefaultEvent ("InfoMessage")]
-#if NET_2_0
public sealed class OleDbConnection : DbConnection, ICloneable
-#else
- public sealed class OleDbConnection : Component, ICloneable, IDbConnection
-#endif
{
#region Fields
[DataCategory ("Data")]
[DefaultValue ("")]
-#if NET_1_0 || ONLY_1_1
- [DataSysDescriptionAttribute ("Information used to connect to a Data Source.")]
-#endif
[EditorAttribute ("Microsoft.VSDesigner.Data.ADO.Design.OleDbConnectionStringEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
[RecommendedAsConfigurable (true)]
[RefreshPropertiesAttribute (RefreshProperties.All)]
- public
-#if NET_2_0
- override
-#endif
- string ConnectionString {
+ public override string ConnectionString {
get {
if (connectionString == null)
return string.Empty;
}
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
-#if !NET_2_0
- [DataSysDescriptionAttribute ("Current connection timeout value, 'Connect Timeout=X' in the ConnectionString.")]
-#endif
- public
-#if NET_2_0
- override
-#endif
- int ConnectionTimeout {
+ public override int ConnectionTimeout {
get {
return connectionTimeout;
}
}
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
-#if !NET_2_0
- [DataSysDescriptionAttribute ("Current data source catalog value, 'Initial Catalog=X' in the connection string.")]
-#endif
- public
-#if NET_2_0
- override
-#endif
+ public override
string Database {
get {
if (gdaConnection != IntPtr.Zero
}
}
-#if NET_2_0
[BrowsableAttribute (true)]
-#else
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
- [DataSysDescriptionAttribute ("Current data source, 'Data Source=X' in the connection string.")]
-#endif
- public
-#if NET_2_0
- override
-#endif
- string DataSource {
+ public override string DataSource {
get {
if (gdaConnection != IntPtr.Zero
&& libgda.gda_connection_is_open (gdaConnection)) {
}
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
-#if NET_2_0
[BrowsableAttribute (true)]
-#else
- [DataSysDescriptionAttribute ("Current OLE DB provider progid, 'Provider=X' in the connection string.")]
-#endif
public string Provider {
get {
if (gdaConnection != IntPtr.Zero
}
}
-#if !NET_2_0
- [DataSysDescriptionAttribute ("Version of the product accessed by the OLE DB Provider.")]
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
- [BrowsableAttribute (false)]
-#endif
- public
-#if NET_2_0
- override
-#endif
- string ServerVersion {
+ public override string ServerVersion {
get {
if (State == ConnectionState.Closed)
throw ExceptionHelper.ConnectionClosed ();
}
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
-#if !NET_2_0
- [DataSysDescriptionAttribute ("The ConnectionState indicating whether the connection is open or closed.")]
-#endif
[BrowsableAttribute (false)]
- public
-#if NET_2_0
- override
-#endif
- ConnectionState State {
+ public override ConnectionState State {
get {
if (gdaConnection != IntPtr.Zero) {
if (libgda.gda_connection_is_open (gdaConnection))
return new OleDbTransaction (this, isolationLevel);
}
-#if NET_2_0
protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
{
return BeginTransaction (isolationLevel);
{
return CreateCommand ();
}
-#else
- IDbTransaction IDbConnection.BeginTransaction ()
- {
- return BeginTransaction ();
- }
-
- IDbTransaction IDbConnection.BeginTransaction (IsolationLevel isolationLevel)
- {
- return BeginTransaction (isolationLevel);
- }
-
- IDbCommand IDbConnection.CreateCommand ()
- {
- return CreateCommand ();
- }
-#endif
- public
-#if NET_2_0
- override
-#endif
- void ChangeDatabase (string value)
+ public override void ChangeDatabase (string value)
{
if (State != ConnectionState.Open)
throw new InvalidOperationException ();
throw new OleDbException (this);
}
- public
-#if NET_2_0
- override
-#endif
- void Close ()
+ public override void Close ()
{
if (State == ConnectionState.Open) {
libgda.gda_connection_close (gdaConnection);
}
public
-#if NET_2_0
override
-#endif
void Open ()
{
- string provider = "Default";
- string gdaCncStr = string.Empty;
- string[] args;
- int len;
- char [] separator = { ';' };
+// string provider = "Default";
+// string gdaCncStr = string.Empty;
+// string[] args;
+// int len;
+// char [] separator = { ';' };
if (State == ConnectionState.Open)
throw new InvalidOperationException ();
throw new NotImplementedException ();
}
-#if NET_2_0
[MonoTODO]
public override void EnlistTransaction (Transaction transaction)
{
{
throw new NotImplementedException ();
}
-#endif
#endregion
#region Events and Delegates
-#if !NET_2_0
- [DataSysDescription ("Event triggered when messages arrive from the DataSource.")]
-#endif
[DataCategory ("DataCategory_InfoMessage")]
public event OleDbInfoMessageEventHandler InfoMessage;
-#if !NET_2_0
- [DataSysDescription ("Event triggered when the connection changes state.")]
- [DataCategory ("DataCategory_StateChange")]
- public event StateChangeEventHandler StateChange;
-#endif
#endregion
}