2002-07-10 Tim Coleman <tim@timcoleman.com>
authorTim Coleman <tim@mono-cvs.ximian.com>
Wed, 10 Jul 2002 05:24:00 +0000 (05:24 -0000)
committerTim Coleman <tim@mono-cvs.ximian.com>
Wed, 10 Jul 2002 05:24:00 +0000 (05:24 -0000)
        * OleDbCommandBuilder.cs: Added new methods, properties
        * OleDbConnection.cs: Modified constructor
        * OleDbError.cs: Added stubbs
        * OleDbException.cs: Added stubbs
        * OleDbInfoMessageEventArgs.cs: Added stubbs
        * OleDbInfoMessageEventHandler.cs: style change
        * OleDbParameter.cs: Added conversion from type to OleDbType
        * OleDbPermission.cs: Added stubbs
        * OleDbSchemaGuid.cs: Added stubbs
        * OleDbTransaction.cs: New constructors, changes to methods to
                support transaction nesting
        * libgda.cs: Added my name to this file

svn path=/trunk/mcs/; revision=5679

12 files changed:
mcs/class/System.Data/System.Data.OleDb/ChangeLog
mcs/class/System.Data/System.Data.OleDb/OleDbCommandBuilder.cs
mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs
mcs/class/System.Data/System.Data.OleDb/OleDbError.cs
mcs/class/System.Data/System.Data.OleDb/OleDbException.cs
mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventArgs.cs
mcs/class/System.Data/System.Data.OleDb/OleDbInfoMessageEventHandler.cs
mcs/class/System.Data/System.Data.OleDb/OleDbParameter.cs
mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs
mcs/class/System.Data/System.Data.OleDb/OleDbSchemaGuid.cs
mcs/class/System.Data/System.Data.OleDb/OleDbTransaction.cs
mcs/class/System.Data/System.Data.OleDb/libgda.cs

index ad458a0a521c483e64db231bf90ec555856fee86..24266700ba3fd56367d800bb9e39a046021bffe5 100644 (file)
@@ -1,3 +1,17 @@
+2002-07-10  Tim Coleman <tim@timcoleman.com>
+       * OleDbCommandBuilder.cs: Added new methods, properties
+       * OleDbConnection.cs: Modified constructor
+       * OleDbError.cs: Added stubbs
+       * OleDbException.cs: Added stubbs
+       * OleDbInfoMessageEventArgs.cs: Added stubbs
+       * OleDbInfoMessageEventHandler.cs: style change
+       * OleDbParameter.cs: Added conversion from type to OleDbType
+       * OleDbPermission.cs: Added stubbs
+       * OleDbSchemaGuid.cs: Added stubbs
+       * OleDbTransaction.cs: New constructors, changes to methods to
+               support transaction nesting
+       * libgda.cs: Added my name to this file
+
 2002-07-09  Tim Coleman <tim@timcoleman.com>
        * OleDbCommand.cs: Style changes, added new methods
        * OleDbConnection.cs: Style changes, added new methods
index 60a3d4e5e682062e2e596324f10faa73bbe590f2..bc4307247428973e201f0f0968ff6ed27ec3d844 100644 (file)
@@ -3,8 +3,10 @@
 //
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System.ComponentModel;
@@ -18,25 +20,88 @@ namespace System.Data.OleDb
        /// </summary>
        public sealed class OleDbCommandBuilder : Component
        {
-               private OleDbDataAdapter m_adapter = null;
+               #region Fields
+
+               OleDbDataAdapter adapter;
+               string quotePrefix;
+               string quoteSuffix;
+
+               #endregion // Fields
+
+               #region Constructors
                
                public OleDbCommandBuilder ()
                {
+                       adapter = null;
+                       quotePrefix = String.Empty;
+                       quoteSuffix = String.Empty;
                }
 
-               public OleDbCommandBuilder (OleDbDataAdapter adapter) : this ()
+               public OleDbCommandBuilder (OleDbDataAdapter adapter) 
+                       : this ()
                {
-                       m_adapter = adapter;
+                       this.adapter = adapter;
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public OleDbDataAdapter DataAdapter {
+                       get { return adapter; }
+                       set { adapter = value; }
                }
 
-               public OleDbDataAdapter DataAdapter
+               public string QuotePrefix {
+                       get { return quotePrefix; }
+                       set { quotePrefix = value; }
+               }
+
+               public string QuoteSuffix {
+                       get { return quoteSuffix; }
+                       set { quoteSuffix = value; }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               [MonoTODO]
+               public static void DeriveParameters (OleDbCommand command) 
                {
-                       get {
-                               return m_adapter;
-                       }
-                       set {
-                               m_adapter = value;
-                       }
+                       throw new NotImplementedException ();           
                }
+
+               [MonoTODO]
+               protected override void Dispose (bool disposing) 
+               {
+                       throw new NotImplementedException ();           
+               }
+
+               [MonoTODO]
+               public OleDbCommand GetDeleteCommand ()
+               {
+                       throw new NotImplementedException ();           
+               }
+
+               [MonoTODO]
+               public OleDbCommand GetInsertCommand ()
+               {
+                       throw new NotImplementedException ();           
+               }
+
+               [MonoTODO]
+               public OleDbCommand GetUpdatetCommand ()
+               {
+                       throw new NotImplementedException ();           
+               }
+
+               [MonoTODO]
+               public void RefreshSchema ()
+               {
+                       throw new NotImplementedException ();           
+               }
+
+               #endregion // Methods
        }
 }
index fed3148ccb8e888196d780aaeefd5fa5686c1f92..f246b1e523f0bfd83620c8f9d2a80877f9abcc53 100644 (file)
@@ -20,11 +20,10 @@ namespace System.Data.OleDb
                #region Fields
 
                string connectionString;
-               int connectionTimeout = 15;
+               int connectionTimeout;
                OleDbDataReader dataReader;
                bool dataReaderOpen;
-
-               IntPtr gdaConnection = IntPtr.Zero;
+               IntPtr gdaConnection;
 
                #endregion
 
@@ -32,6 +31,8 @@ namespace System.Data.OleDb
                
                public OleDbConnection ()
                {
+                       gdaConnection = IntPtr.Zero;
+                       connectionTimeout = 15;
                }
 
                public OleDbConnection (string connectionString) 
index ad6b97c1a93acd4bfd6b824a0dbd83b09caf9bad..6be0721c2cb4f823dc2aeac385e58e5434636510 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Data.OleDb.OleDbError
 //
-// Author:
+// Authors:
 //   Rodrigo Moya (rodrigo@ximian.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System.Data;
@@ -14,5 +16,38 @@ namespace System.Data.OleDb
 {
        public sealed class OleDbError
        {
+               #region Properties
+
+               public string Message {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public int NativeError {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string Source {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string SqlState {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               #endregion
+
+               #region Methods
+
+               [MonoTODO]
+               public override string ToString ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion
        }
 }
index edb036cb9984139ff933afdb98f9f2d05719fc15..9727f111f8785368000132822df6bb60735e0718 100644 (file)
@@ -3,18 +3,54 @@
 //
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System.Data;
 using System.Data.Common;
 using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
 
 namespace System.Data.OleDb
 {
        [Serializable]
        public sealed class OleDbException : ExternalException
        {
+               #region Properties
+
+               public override int ErrorCode { 
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public OleDbErrorCollection Errors {    
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override string Message {        
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public override string Source { 
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               [MonoTODO]
+               public override void GetObjectData (SerializationInfo si, StreamingContext context)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion // Methods
        }
 }
index 1d6fda59dff9173b4934c0b2496a69613f537428..9c0b5fa89bf75904d87a916a4625c326ec0eb0a8 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Data.OleDb.OleDbInfoMessageEventArgs
 //
-// Author:
+// Authors:
 //   Rodrigo Moya (rodrigo@ximian.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System.Data;
@@ -14,5 +16,38 @@ namespace System.Data.OleDb
 {
        public sealed class OleDbInfoMessageEventArgs : EventArgs
        {
+               #region Properties
+
+               public int ErrorCode {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public OleDbErrorCollection Errors {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string Message {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               public string Source {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               [MonoTODO]
+               public override string ToString ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion // Methods
        }
 }
index e10f39503141a109f24be3ac8c6b4318c8f80973..60fd9c9633930dd0b7ce80e9576f8c740ec633d1 100644 (file)
@@ -13,7 +13,5 @@ using System.Data.Common;
 namespace System.Data.OleDb
 {
        [Serializable]
-       public delegate void OleDbInfoMessageEventHandler (
-               object sender,
-               OleDbInfoMessageEventArgs e);
+       public delegate void OleDbInfoMessageEventHandler (object sender, OleDbInfoMessageEventArgs e);
 }
index 3ee38335c1fec01e119e494ad76b56e4756f5595..319bfb29d40f53ea4e05a35f449dd34726ebf3c6 100644 (file)
@@ -9,6 +9,7 @@
 // Copyright (C) Tim Coleman, 2002
 //
 
+using System;
 using System.Data;
 using System.Data.Common;
 
@@ -30,6 +31,8 @@ namespace System.Data.OleDb
                OleDbType oleDbType;
                DbType dbType;
 
+               IntPtr gdaParameter;
+
                #endregion
 
                #region Constructors
@@ -43,6 +46,7 @@ namespace System.Data.OleDb
                        precision = 0;
                        scale = 0;
                        sourceColumn = String.Empty;
+                       gdaParameter = IntPtr.Zero;
                }
 
                public OleDbParameter (string name, object value) 
@@ -50,13 +54,14 @@ namespace System.Data.OleDb
                {
                        this.name = name;
                        this.value = value;
+                       OleDbType = GetOleDbType (value);
                }
 
                public OleDbParameter (string name, OleDbType dataType) 
                        : this ()
                {
                        this.name = name;
-                       this.oleDbType = dataType;
+                       OleDbType = dataType;
                }
 
                public OleDbParameter (string name, OleDbType dataType, int size)
@@ -144,11 +149,19 @@ namespace System.Data.OleDb
                
                public object Value {
                        get { return value; }
-                       set { value = value; }
+                       set { this.value = value; }
                }
 
                #endregion // Properties
 
+               #region Internal Properties
+
+               internal IntPtr GdaParameter {
+                       get { return gdaParameter; }
+               }
+
+               #endregion // Internal Properties
+
                #region Methods
 
                [MonoTODO]
@@ -298,6 +311,55 @@ namespace System.Data.OleDb
                        return DbType.Object;
                }
 
+               private OleDbType GetOleDbType (object value)
+               {
+                       if (value is Guid) return OleDbType.Guid;
+                       if (value is TimeSpan) return OleDbType.DBTime;
+
+                       switch (Type.GetTypeCode (value.GetType ())) {
+                       case TypeCode.Boolean :
+                               return OleDbType.Boolean;
+                       case TypeCode.Byte :
+                               if (value.GetType().IsArray) 
+                                       return OleDbType.Binary;
+                               else 
+                                       return OleDbType.UnsignedTinyInt;
+                       case TypeCode.Char :
+                               return OleDbType.Char;
+                       case TypeCode.DateTime :
+                               return OleDbType.Date;
+                       case TypeCode.DBNull :
+                               return OleDbType.Empty;
+                       case TypeCode.Decimal :
+                               return OleDbType.Decimal;
+                       case TypeCode.Double :
+                               return OleDbType.Double;
+                       case TypeCode.Empty :
+                               return OleDbType.Empty;
+                       case TypeCode.Int16 :
+                               return OleDbType.SmallInt;
+                       case TypeCode.Int32 :
+                               return OleDbType.Integer;
+                       case TypeCode.Int64 :
+                               return OleDbType.BigInt;
+                       case TypeCode.SByte :
+                               return OleDbType.TinyInt;
+                       case TypeCode.String :
+                               return OleDbType.VarChar;
+                       case TypeCode.Single :
+                               return OleDbType.Single;
+                       case TypeCode.UInt64 :
+                               return OleDbType.UnsignedBigInt;
+                       case TypeCode.UInt32 :
+                               return OleDbType.UnsignedInt;
+                       case TypeCode.UInt16 :
+                               return OleDbType.UnsignedSmallInt;
+                       case TypeCode.Object :
+                               return OleDbType.Variant;
+                       }
+                       return OleDbType.IUnknown;
+               }
+
                #endregion
        }
 }
index d399380e58b3bf75f2d3adf8a10bff55bb8cfaac..2bf95972a5e43e6bf7eebc99cef6f9819ac2e886 100644 (file)
@@ -3,16 +3,93 @@
 //
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System.Data;
 using System.Data.Common;
+using System.Security;
+using System.Security.Permissions;
 
 namespace System.Data.OleDb
 {
+       [Serializable]
        public sealed class OleDbPermission : DBDataPermission
        {
+               #region Constructors
+
+               [MonoTODO]
+               public OleDbPermission ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public OleDbPermission (PermissionState state)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public OleDbPermission (PermissionState state, bool allowBlankPassword)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion
+
+               #region Properties
+
+               public string Provider {
+                       [MonoTODO]
+                       get { throw new NotImplementedException (); }
+                       [MonoTODO]
+                       set { throw new NotImplementedException (); }
+               }
+
+               #endregion
+
+               #region Methods
+
+               [MonoTODO]
+               public override IPermission Copy ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override void FromXml (SecurityElement securityElement)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override IPermission Intersect (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override bool IsSubsetOf (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override SecurityElement ToXml ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override IPermission Union (IPermission target)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion
        }
 }
index 4ed1ca09d11e760907c85921c54063d09e53e4e1..502d07ee2dd3353bdcdb62a8cf1e0d5af96368d1 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Data.OleDb.OleDbSchemaGuid
 //
-// Author:
+// Authors:
 //   Rodrigo Moya (rodrigo@ximian.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System.Data;
@@ -14,5 +16,54 @@ namespace System.Data.OleDb
 {
        public sealed class OleDbSchemaGuid
        {
+               #region Fields
+
+               public static readonly Guid Assertions;
+               public static readonly Guid Catalogs;
+               public static readonly Guid Character_Sets;
+               public static readonly Guid Check_Constraints;
+               public static readonly Guid Check_Constraints_By_Table;
+               public static readonly Guid Collations;
+               public static readonly Guid Columns;
+               public static readonly Guid Column_Domain_Usage;
+               public static readonly Guid Column_Privileges;
+               public static readonly Guid Constraint_Column_Usage;
+               public static readonly Guid Constraint_Table_Usage;
+               public static readonly Guid DbInfoLiterals;
+               public static readonly Guid Foreign_Keys;
+               public static readonly Guid Indexes;
+               public static readonly Guid Key_Column_Usage;
+               public static readonly Guid Primary_Keys;
+               public static readonly Guid Procedures;
+               public static readonly Guid Procedure_Columns;
+               public static readonly Guid Procedure_Parameters;
+               public static readonly Guid Provider_Types;
+               public static readonly Guid Referential_Constraints;
+               public static readonly Guid Schemata;
+               public static readonly Guid Sql_Languages;
+               public static readonly Guid Statistics;
+               public static readonly Guid Tables;
+               public static readonly Guid Tables_Info;
+               public static readonly Guid Table_Constraints;
+               public static readonly Guid Table_Privileges;
+               public static readonly Guid Table_Statistics;
+               public static readonly Guid Translations;
+               public static readonly Guid Trustee;
+               public static readonly Guid Usage_Privileges;
+               public static readonly Guid Views;
+               public static readonly Guid View_Column_Usage;
+               public static readonly Guid View_Table_Usage;
+
+               #endregion
+
+               #region Constructors
+
+               [MonoTODO]
+               public OleDbSchemaGuid ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion
        }
 }
index 2233b7f255dfc49e37639cf60789f7a2cd381898..763955ff4a1852b368ad83e39018d9c2c83cbdf9 100644 (file)
@@ -16,28 +16,43 @@ namespace System.Data.OleDb
 {
        public sealed class OleDbTransaction : MarshalByRefObject, IDbTransaction, IDisposable
        {
-
                #region Fields
 
-               OleDbConnection connection = null;
-               IsolationLevel isolationLevel = IsolationLevel.ReadCommitted;
+               OleDbConnection connection;
+               IsolationLevel isolationLevel;
+               IntPtr gdaTransaction;
+               int depth;
 
                #endregion // Fields
 
                #region Constructors
-               
-               internal OleDbTransaction (OleDbConnection connection)
+
+               internal OleDbTransaction (OleDbConnection connection, int depth)
                {
                        this.connection = connection;
-                       libgda.gda_connection_begin_transaction (connection.GdaConnection, IntPtr.Zero);
+                       isolationLevel = IsolationLevel.ReadCommitted;
+
+                       gdaTransaction = libgda.gda_transaction_new (depth.ToString ());
+                       libgda.gda_connection_begin_transaction (connection.GdaConnection, gdaTransaction);
                }
 
-               internal OleDbTransaction (OleDbConnection connection, IsolationLevel isolevel) 
-                       : this (connection)
+               internal OleDbTransaction (OleDbConnection connection)
+                       : this (connection, 1)
+               {
+               }
+
+               internal OleDbTransaction (OleDbConnection connection, int depth, IsolationLevel isolevel) 
+                       : this (connection, depth)
                {
                        isolationLevel = isolevel;
                }
 
+               internal OleDbTransaction (OleDbConnection connection, IsolationLevel isolevel) 
+                       : this (connection, 1, isolevel)
+               {
+               }
+
+
                #endregion // Constructors
 
                #region Properties
@@ -46,33 +61,31 @@ namespace System.Data.OleDb
                        get { return connection; }
                }
 
-               public IsolationLevel IsolationLevel
-               {
+               public IsolationLevel IsolationLevel {
                        get { return isolationLevel; }
                }
 
                IDbConnection IDbTransaction.Connection {
-                       [MonoTODO]
-                       get { throw new NotImplementedException (); }
+                       get { return connection; }
                }
 
                #endregion // Properties
 
                #region Methods
 
-               public OleDbTransaction Begin ()
+               public OleDbTransaction Begin () 
                {
-                       return new OleDbTransaction (connection);
+                       return new OleDbTransaction (connection, depth + 1);
                }
 
-               public OleDbTransaction Begin (IsolationLevel isolevel)
+               public OleDbTransaction Begin (IsolationLevel isolevel) 
                {
-                       return new OleDbTransaction (connection, isolevel);
+                       return new OleDbTransaction (connection, depth + 1, isolevel);
                }
 
                public void Commit ()
                {
-                       if (!libgda.gda_connection_commit_transaction (connection.GdaConnection, IntPtr.Zero))
+                       if (!libgda.gda_connection_commit_transaction (connection.GdaConnection, gdaTransaction))
                                throw new InvalidOperationException ();
                }
 
@@ -89,7 +102,7 @@ namespace System.Data.OleDb
 
                public void Rollback ()
                {
-                       if (!libgda.gda_connection_rollback_transaction (connection.GdaConnection, IntPtr.Zero))
+                       if (!libgda.gda_connection_rollback_transaction (connection.GdaConnection, gdaTransaction))
                                throw new InvalidOperationException ();
                }
 
index f7054c9a72e85da88d283f08c5c91253d9aa8ea5..e4149f82545606018b9908a22651e3e0336d7ba3 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Data.OleDb.libgda
 //
-// Author:
+// Authors:
 //   Rodrigo Moya (rodrigo@ximian.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System.Data;