2002-11-04 Tim Coleman <tim@timcoleman.com>
authorTim Coleman <tim@mono-cvs.ximian.com>
Mon, 4 Nov 2002 18:23:26 +0000 (18:23 -0000)
committerTim Coleman <tim@mono-cvs.ximian.com>
Mon, 4 Nov 2002 18:23:26 +0000 (18:23 -0000)
        * list:
                Add Mono.Data.TdsClient.Internal.TdsBigDecimal
                Add System.Data.SqlClient.SqlParameterConverter
                Add System.Data.DataSysDescriptionAttribute
        * System.Data/DataSysDescriptionAttribute.cs:
                New class added
        * System.Data.Common/DbDataPermission.cs:
                Add CreateInstance method
        * System.Data.SqlClient/SqlClientPermission.cs:
        * System.Data.SqlClient/SqlError.cs:
                Add Serializable attribute
        * System.Data.SqlClient/SqlCommand.cs:
        * System.Data.SqlClient/SqlConnection.cs:
        * System.Data.SqlClient/SqlDataAdapter.cs:
        * System.Data.SqlClient/SqlParameter.cs:
                Add some missing property attributes
        * System.Data.SqlClient/SqlCommandBuilder.cs:
                Add some missing property attributes
                Implement properties
        * System.Data.SqlClient/SqlDataReader.cs:
                Implement missing methods
        * System.Data.SqlClient/SqlErrorCollection.cs:
                Implement the properties
        * System.Data.SqlClient/SqlException.cs:
                Remove extra property accessors
        * System.Data.SqlClient/SqlInfoMessageEventArgs.cs:
                Add internal constructor
        * System.Data.SqlClient/SqlParameterCollection.cs:
                Add internal constructor
                Add property attributes
        * System.Data.SqlClient/SqlParameterConverter.cs:
                New internal class added
        * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs:
        * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs:
                Remove destructor
        * System.Data.SqlTypes/SqlDecimal.cs:
                Add implicit conversion from TdsBigDecimal to SqlDecimal
        * System.Data.SqlTypes/SqlString.cs:
        * System.Data.SqlTypes/SqlInt16.cs:
        * System.Data.SqlTypes/SqlDateTime.cs:
                Change code to remove compiler warnings

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

23 files changed:
mcs/class/System.Data/ChangeLog
mcs/class/System.Data/System.Data.Common/DbDataPermission.cs
mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs
mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs
mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs
mcs/class/System.Data/System.Data.SqlClient/SqlError.cs
mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs
mcs/class/System.Data/System.Data.SqlClient/SqlException.cs
mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs
mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs
mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs
mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlDateTime.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlDecimal.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlInt16.cs
mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs
mcs/class/System.Data/System.Data/DataSysDescriptionAttribute.cs [new file with mode: 0644]
mcs/class/System.Data/list

index 120c06e2082a2c157201403a73a25fd9fd7a2a94..3f4ff8a8718edd3ec706e3918434d5da034d69b2 100644 (file)
@@ -1,3 +1,46 @@
+2002-11-04  Tim Coleman <tim@timcoleman.com>
+       * list:
+               Add Mono.Data.TdsClient.Internal.TdsBigDecimal
+               Add System.Data.SqlClient.SqlParameterConverter
+               Add System.Data.DataSysDescriptionAttribute
+       * System.Data/DataSysDescriptionAttribute.cs:
+               New class added
+       * System.Data.Common/DbDataPermission.cs:
+               Add CreateInstance method
+       * System.Data.SqlClient/SqlClientPermission.cs:
+       * System.Data.SqlClient/SqlError.cs:
+               Add Serializable attribute
+       * System.Data.SqlClient/SqlCommand.cs:
+       * System.Data.SqlClient/SqlConnection.cs:
+       * System.Data.SqlClient/SqlDataAdapter.cs:
+       * System.Data.SqlClient/SqlParameter.cs:
+               Add some missing property attributes
+       * System.Data.SqlClient/SqlCommandBuilder.cs:
+               Add some missing property attributes
+               Implement properties
+       * System.Data.SqlClient/SqlDataReader.cs:
+               Implement missing methods
+       * System.Data.SqlClient/SqlErrorCollection.cs:
+               Implement the properties
+       * System.Data.SqlClient/SqlException.cs:
+               Remove extra property accessors
+       * System.Data.SqlClient/SqlInfoMessageEventArgs.cs:
+               Add internal constructor
+       * System.Data.SqlClient/SqlParameterCollection.cs:
+               Add internal constructor
+               Add property attributes
+       * System.Data.SqlClient/SqlParameterConverter.cs:
+               New internal class added
+       * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs:
+       * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs:
+               Remove destructor
+       * System.Data.SqlTypes/SqlDecimal.cs:
+               Add implicit conversion from TdsBigDecimal to SqlDecimal
+       * System.Data.SqlTypes/SqlString.cs:
+       * System.Data.SqlTypes/SqlInt16.cs:
+       * System.Data.SqlTypes/SqlDateTime.cs:
+               Change code to remove compiler warnings
+
 2002-11-04  Stuart Caborn <stuart.caborn@clearswift.com>
 
        * list: added System.Data/XmlConstants.cs to
index 72f92da0d8a7d3b8517999c6bb1b788d08810f69..a667509c83e7b73db0cb55a2abd4ad71b5d7be9f 100644 (file)
@@ -1,83 +1,95 @@
 //
-// System.Data.Common.DbDataAdapter.cs
+// System.Data.Common.DbDataPermission.cs
 //
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // (C) Ximian, Inc
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System.Security;
 using System.Security.Permissions;
 
-namespace System.Data.Common
-{
+namespace System.Data.Common {
        /// <summary>
        /// Provides the capability for a .NET data provider to ensure that a user has a security level adequate for accessing data.
        /// </summary>
-       public abstract class DBDataPermission : CodeAccessPermission,
-               IUnrestrictedPermission
+       public abstract class DBDataPermission : CodeAccessPermission, IUnrestrictedPermission
        {
                private bool allowBlankPassword;
                private PermissionState permissionState;
 
-               protected DBDataPermission () {
+               protected DBDataPermission () 
+               {
                        allowBlankPassword = false;
                        permissionState = PermissionState.None;
                }
 
-               protected DBDataPermission (PermissionState state) {
+               protected DBDataPermission (PermissionState state) 
+               {
                        allowBlankPassword = false;
                        permissionState = state;
                }
 
-               public DBDataPermission (PermissionState state, bool abp) {
+               public DBDataPermission (PermissionState state, bool abp) 
+               {
                        allowBlankPassword = abp;
                        permissionState = state;
                }
 
-               public override IPermission Copy () {
+               public bool AllowBlankPassword {
+                       get { return allowBlankPassword; }
+                       set { allowBlankPassword = value; }
+               }
+
+               public override IPermission Copy () 
+               {
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
-               public override void FromXml (SecurityElement securityElement) {
+               protected virtual DBDataPermission CreateInstance ()
+               {
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
-               public override IPermission Intersect (IPermission target) {
+               public override void FromXml (SecurityElement securityElement) 
+               {
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
-               public override bool IsSubsetOf (IPermission target) {
+               public override IPermission Intersect (IPermission target) 
+               {
                        throw new NotImplementedException ();
                }
 
-               public bool IsUnrestricted () {
+               [MonoTODO]
+               public override bool IsSubsetOf (IPermission target) 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public bool IsUnrestricted () 
+               {
                        if (permissionState == PermissionState.Unrestricted)
                                return true;
                        return false;
                }
 
                [MonoTODO]
-               public override SecurityElement ToXml () {
+               public override SecurityElement ToXml () 
+               {
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
-               public override IPermission Union (IPermission target) {
+               public override IPermission Union (IPermission target) 
+               {
                        throw new NotImplementedException ();
                }
-               
-               public bool AllowBlankPassword {
-                       get {
-                               return allowBlankPassword;
-                       }
-                       set {
-                               allowBlankPassword = value;
-                       }
-               }
        }
 }
index dc7384fc38798e601e5ebf0b77f4779a5a4b193a..28ee5e1b5a3b0a546e088981b310bf6185c5c2f1 100644 (file)
@@ -4,8 +4,10 @@
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
 //   Daniel Morgan (danmorg@sc.rr.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System;
@@ -15,6 +17,7 @@ using System.Security;
 using System.Security.Permissions;
 
 namespace System.Data.SqlClient {
+       [Serializable]
        public sealed class SqlClientPermission : DBDataPermission 
        {
                [MonoTODO]
index 43cd609fb943c854993d9f3f0c4f7102727cfbaa..7d47f06504842a43327bcf8c477eec4778291e28 100644 (file)
@@ -34,10 +34,11 @@ namespace System.Data.SqlClient {
                CommandType commandType;
                SqlConnection connection;
                SqlTransaction transaction;
-               SqlParameterCollection parameters = new SqlParameterCollection ();
+               UpdateRowSource updatedRowSource;
 
                CommandBehavior behavior = CommandBehavior.Default;
                NameValueCollection preparedStatements = new NameValueCollection ();
+               SqlParameterCollection parameters;
 
                #endregion // Fields
 
@@ -66,9 +67,11 @@ namespace System.Data.SqlClient {
                        this.connection = connection;
                        this.transaction = transaction;
                        this.commandType = CommandType.Text;
+                       this.updatedRowSource = UpdateRowSource.Both;
 
                        this.designTimeVisible = false;
                        this.commandTimeout = 30;
+                       parameters = new SqlParameterCollection (this);
                }
 
                #endregion // Constructors
@@ -79,11 +82,16 @@ namespace System.Data.SqlClient {
                        get { return behavior; }
                }
 
+               [DataSysDescription ("Command text to execute.")]
+               [DefaultValue ("")]
+               [RefreshProperties (RefreshProperties.All)]
                public string CommandText {
                        get { return CommandText; }
                        set { commandText = value; }
                }
 
+               [DataSysDescription ("Time to wait for command to execute.")]
+               [DefaultValue (30)]
                public int CommandTimeout {
                        get { return commandTimeout;  }
                        set { 
@@ -93,11 +101,16 @@ namespace System.Data.SqlClient {
                        }
                }
 
+               [DataSysDescription ("How to interpret the CommandText.")]
+               [DefaultValue (CommandType.Text)]
+               [RefreshProperties (RefreshProperties.All)]
                public CommandType CommandType  {
                        get { return commandType; }
                        set { commandType = value; }
                }
 
+               [DefaultValue (null)]
+               [DataSysDescription ("Connection used by the command.")]
                public SqlConnection Connection {
                        get { return connection; }
                        set { 
@@ -108,11 +121,16 @@ namespace System.Data.SqlClient {
                        }
                }
 
+               [Browsable (false)]
+               [DefaultValue (true)]
+               [DesignOnly (true)]
                public bool DesignTimeVisible {
                        get { return designTimeVisible; } 
                        set { designTimeVisible = value; }
                }
 
+               [DataSysDescription ("The parameters collection.")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
                public SqlParameterCollection Parameters {
                        get { return parameters; }
                }
@@ -143,15 +161,19 @@ namespace System.Data.SqlClient {
                        }
                }
 
+               [Browsable (false)]
+               [DataSysDescription ("The transaction used by the command.")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public SqlTransaction Transaction {
                        get { return transaction; }
                        set { transaction = value; }
                }       
 
-               [MonoTODO]
+               [DataSysDescription ("When used by a DataAdapter.Update, how command results are applied to the current DataRow.")]
+               [DefaultValue (UpdateRowSource.Both)]
                public UpdateRowSource UpdatedRowSource {
-                       get { throw new NotImplementedException (); }
-                       set { throw new NotImplementedException (); }
+                       get { return updatedRowSource; }
+                       set { updatedRowSource = value; }
                }
 
                #endregion // Fields
@@ -199,7 +221,7 @@ namespace System.Data.SqlClient {
                                        parms.Append (" output");
                        }
 
-                       SqlParameterCollection localParameters = new SqlParameterCollection ();
+                       SqlParameterCollection localParameters = new SqlParameterCollection (this);
                        SqlParameter parm;
                
                        parm = new SqlParameter ("@P1", SqlDbType.NVarChar);
@@ -231,7 +253,7 @@ namespace System.Data.SqlClient {
                                        parms.Append (" output");
                        }
 
-                       SqlParameterCollection localParameters = new SqlParameterCollection ();
+                       SqlParameterCollection localParameters = new SqlParameterCollection (this);
                        SqlParameter parm;
                
                        parm = new SqlParameter ("@P1", SqlDbType.Int);
index d2b028bc652399acda1325cc6b9228e1b0f0a309..0ce7a6e6fefa1556d52cbe9e307c30260dcf334f 100644 (file)
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
 //   Daniel Morgan (danmorg@sc.rr.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System;
 using System.Data;
 using System.ComponentModel;
 
-namespace System.Data.SqlClient {\r
-\r
-       /// <summary>\r
-       /// Builder of one command\r
-       /// that will be used in manipulating a table for\r
-       /// a DataSet that is assoicated with a database.\r
-       /// </summary>\r
-       public sealed class SqlCommandBuilder : Component {\r
-               \r
-               [MonoTODO]\r
-               public SqlCommandBuilder() {\r
-\r
-               }\r
-\r
-               [MonoTODO]\r
-               public SqlCommandBuilder(SqlDataAdapter adapter) {\r
-               \r
-               }\r
-\r
-               [MonoTODO]\r
-               public SqlDataAdapter DataAdapter {\r
-                       get {\r
-                               throw new NotImplementedException ();\r
-                       }\r
-                       \r
-                       set{\r
-                               throw new NotImplementedException ();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public string QuotePrefix {\r
-                       get {\r
-                               throw new NotImplementedException ();\r
-                       } \r
-                       \r
-                       set {\r
-                               throw new NotImplementedException ();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public string QuoteSuffix {\r
-                       get {\r
-                               throw new NotImplementedException ();\r
-                       }\r
-                       \r
-                       set {\r
-                               throw new NotImplementedException ();\r
-                       }\r
-               }\r
-\r
-               [MonoTODO]\r
-               public static void DeriveParameters(SqlCommand command) {\r
-                       throw new NotImplementedException ();\r
-               }\r
-\r
-               [MonoTODO]\r
-               public SqlCommand GetDeleteCommand() {\r
-                       throw new NotImplementedException ();\r
-               }\r
-\r
-               [MonoTODO]\r
-               public SqlCommand GetInsertCommand() {\r
-                       throw new NotImplementedException ();\r
-               }\r
-\r
-               [MonoTODO]\r
-               public SqlCommand GetUpdateCommand() {\r
-                       throw new NotImplementedException ();\r
-               }\r
-\r
-               [MonoTODO]\r
-               public void RefreshSchema() {\r
-                       throw new NotImplementedException ();\r
-               }\r
-\r
-               [MonoTODO]\r
-               protected override void Dispose(bool disposing) {\r
-                       throw new NotImplementedException ();\r
-               }\r
-\r
-               [MonoTODO]\r
-               ~SqlCommandBuilder() {\r
-                       // FIXME: create destructor - release resources\r
-               }\r
-       }\r
-}\r
-\r
+namespace System.Data.SqlClient {
+       /// <summary>
+       /// Builder of one command
+       /// that will be used in manipulating a table for
+       /// a DataSet that is assoicated with a database.
+       /// </summary>
+       public sealed class SqlCommandBuilder : Component 
+       {
+               #region Fields
+
+               string quotePrefix;
+               string quoteSuffix;
+               SqlDataAdapter adapter;
+
+               #endregion // Fields
+
+               #region Constructors
+
+               public SqlCommandBuilder () 
+                       : this (null)
+               {
+               }
+
+               public SqlCommandBuilder (SqlDataAdapter adapter) 
+               {
+                       this.adapter = adapter;
+                       this.quotePrefix = String.Empty;
+                       this.quoteSuffix = String.Empty;
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               [DataSysDescription ("The DataAdapter for which to automatically generator SqlCommands.")]
+               [DefaultValue (null)]
+               public SqlDataAdapter DataAdapter {
+                       get { return adapter; }
+                       set { 
+                               if (adapter != null)
+                                       adapter.RowUpdating -= new SqlRowUpdatingEventHandler (RowUpdatingHandler);
+                               adapter = value;
+                               adapter.RowUpdating += new SqlRowUpdatingEventHandler (RowUpdatingHandler);
+                       }
+               }
+
+               [Browsable (false)]
+               [DataSysDescription ("The character used in a text command as the opening quote for quoting identifiers that contain special characters.")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               public string QuotePrefix {
+                       get { return quotePrefix; }
+                       set { quotePrefix = value; }
+               }
+
+               [Browsable (false)]
+               [DataSysDescription ("The character used in a text command as the closing quote for quoting identifiers that contain special characters.")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               public string QuoteSuffix {
+                       get { return quoteSuffix; }
+                       set { quoteSuffix = value; }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               [MonoTODO]
+               public static void DeriveParameters (SqlCommand command) 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public SqlCommand GetDeleteCommand () 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public SqlCommand GetInsertCommand () 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public SqlCommand GetUpdateCommand () 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void RefreshSchema () 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               private void RowUpdatingHandler (object sender, SqlRowUpdatingEventArgs e)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               protected override void Dispose (bool disposing) 
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion // Methods
+       }
+}
+
index 1072a0e17dde12f82cf90b91b0fa055de841ad92..9997edce5ce81c6856446bdf492c90f6d35322ef 100644 (file)
@@ -24,6 +24,7 @@ using System.Text;
 using System.Xml;
 
 namespace System.Data.SqlClient {
+       [DefaultEvent ("InfoMessage")]
        public sealed class SqlConnection : Component, IDbConnection, ICloneable        
        {
                #region Fields
@@ -79,16 +80,24 @@ namespace System.Data.SqlClient {
                #endregion // Constructors
 
                #region Properties
-               
+
+               [DataSysDescription ("Information used to connect to a DataSource, such as 'Data Source=x;Initial Catalog=x;Integrated Security=SSPI'.")]
+               [DefaultValue ("")]
+               [RecommendedAsConfigurable (true)]      
+               [RefreshProperties (RefreshProperties.All)]
                public string ConnectionString  {
                        get { return connectionString; }
                        set { SetConnectionString (value); }
                }
-               
+       
+               [DataSysDescription ("Current connection timeout value, 'Connect Timeout=X' in the ConnectionString.")] 
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public int ConnectionTimeout {
                        get { return connectionTimeout; }
                }
 
+               [DataSysDescription ("Current SQL Server database, 'Initial Catalog=X' in the ConnectionString.")]      
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public string Database  {
                        get { return tds.Database; }
                }
@@ -98,18 +107,28 @@ namespace System.Data.SqlClient {
                        set { dataReader = value; }
                }
 
+               [DataSysDescription ("Current SqlServer that the connection is opened to, 'Data Source=X' in the ConnectionString.")]   
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public string DataSource {
                        get { return dataSource; }
                }
 
+               [DataSysDescription ("Network packet size, 'Packet Size=x' in the ConnectionString.")]  
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public int PacketSize {
                        get { return packetSize; }
                }
 
+               [Browsable (false)]
+               [DataSysDescription ("Version of the SQL Server accessed by the SqlConnection.")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public string ServerVersion {
                        get { return tds.ServerVersion; }
                }
 
+               [Browsable (false)]
+               [DataSysDescription ("The ConnectionState indicating whether the connection is open or closed.")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public ConnectionState State {
                        get { return state; }
                }
@@ -122,6 +141,8 @@ namespace System.Data.SqlClient {
                        get { return transaction; }
                }
 
+               [DataSysDescription ("Workstation Id, 'Workstation Id=x' in the ConnectionString.")]    
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public string WorkstationId {
                        get { return parms.Hostname; }
                }
index 338c4a0912eaa49a6867e0f13ef216c9d0dfc871..1fd28d495c77af7a20ff6b6256ed8d83cf6a8292 100644 (file)
@@ -15,13 +15,8 @@ using System.ComponentModel;
 using System.Data;
 using System.Data.Common;
 
-namespace System.Data.SqlClient
-{
-       /// <summary>
-       /// Represents a set of command-related properties that are used 
-       /// to fill the DataSet and update a data source, all this 
-       /// from a SQL database.
-       /// </summary>
+namespace System.Data.SqlClient {
+       [DefaultEvent ("RowUpdated")]
        public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter 
        {
                #region Fields
@@ -65,21 +60,29 @@ namespace System.Data.SqlClient
 
                #region Properties
 
+               [DataSysDescription ("Used during Update for deleted rows in DataSet.")]
+               [DefaultValue (null)]
                public SqlCommand DeleteCommand {
                        get { return deleteCommand; }
                        set { deleteCommand = value; }
                }
 
+               [DataSysDescription ("Used during Update for new rows in DataSet.")]
+               [DefaultValue (null)]
                public SqlCommand InsertCommand {
                        get { return insertCommand; }
                        set { insertCommand = value; }
                }
 
+               [DataSysDescription ("Used during Fill/FillSchema.")]
+               [DefaultValue (null)]
                public SqlCommand SelectCommand {
                        get { return selectCommand; }
                        set { selectCommand = value; }
                }
 
+               [DataSysDescription ("Used during Update for modified rows in DataSet.")]
+               [DefaultValue (null)]
                public SqlCommand UpdateCommand {
                        get { return updateCommand; }
                        set { updateCommand = value; }
@@ -159,11 +162,13 @@ namespace System.Data.SqlClient
 
                #region Events and Delegates
 
+               [DataSysDescription ("Event triggered before every DataRow during Update.")]
                public event SqlRowUpdatedEventHandler RowUpdated {
                        add { Events.AddHandler (EventRowUpdated, value); }
                        remove { Events.RemoveHandler (EventRowUpdated, value); }
                }
 
+               [DataSysDescription ("Event triggered after every DataRow during Update.")]
                public event SqlRowUpdatingEventHandler RowUpdating {
                        add { Events.AddHandler (EventRowUpdating, value); }
                        remove { Events.RemoveHandler (EventRowUpdating, value); }
index 3e5dd0d3814b8805bed221374e53992dde6b07e7..81b0ad82f1dcd7d272aa6d846d1ee403af548edd 100644 (file)
@@ -17,6 +17,7 @@ using System.Collections;
 using System.ComponentModel;
 using System.Data;
 using System.Data.Common;
+using System.Data.SqlTypes;
 
 namespace System.Data.SqlClient {
        public sealed class SqlDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord
@@ -24,7 +25,6 @@ namespace System.Data.SqlClient {
                #region Fields
 
                int fieldCount;
-               bool hasRows;
                bool isClosed;
                int recordsAffected;
                bool moreResults;
@@ -65,10 +65,6 @@ namespace System.Data.SqlClient {
                        get { return fieldCount; }
                }
 
-               public bool HasRows {
-                       get { return hasRows; }
-               }
-
                public bool IsClosed {
                        get { return isClosed; }
                }
@@ -147,7 +143,6 @@ namespace System.Data.SqlClient {
                        return (byte) value;
                }
 
-               [MonoTODO]
                public long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
                {
                        object value = GetValue (i);
@@ -163,7 +158,6 @@ namespace System.Data.SqlClient {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                public long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length)
                {
                        object value = GetValue (i);
@@ -195,10 +189,24 @@ namespace System.Data.SqlClient {
                public decimal GetDecimal (int i)
                {
                        object value = GetValue (i);
-                       if (!(value is decimal))
+                       if (!(value is TdsBigDecimal))
                                throw new InvalidCastException ();
-                       return (decimal) value;
+                       int[] bits = ((TdsBigDecimal) value).Data;
+                       if (bits[3] != 0)
+                               throw new OverflowException ();
+                       byte scale = ((TdsBigDecimal) value).Scale;
+                       bool isNegative = ((TdsBigDecimal) value).IsNegative;
+                       return new Decimal (bits[0], bits[1], bits[2], isNegative, scale);
                }
+
+               private TdsBigDecimal GetDecimalImpl (int i)
+               {
+                       object value = GetValue (i);
+                       if (!(value is TdsBigDecimal))
+                               throw new InvalidCastException ();
+                       return (TdsBigDecimal) value;
+               }
+
                public double GetDouble (int i)
                {
                        object value = GetValue (i);
@@ -447,6 +455,146 @@ namespace System.Data.SqlClient {
                        return schemaTable;
                }               
 
+               public SqlBinary GetSqlBinary (int i)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public SqlBoolean GetSqlBoolean (int i) 
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlBoolean.Null;
+                       if (!(value is bool))
+                               throw new InvalidCastException ();
+                       return (bool) value;
+               }
+
+               public SqlByte GetSqlByte (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlByte.Null;
+                       if (!(value is byte))
+                               throw new InvalidCastException ();
+                       return (byte) value;
+               }
+
+               public SqlDateTime GetSqlDateTime (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlDateTime.Null;
+                       if (!(value is DateTime))
+                               throw new InvalidCastException ();
+                       return (DateTime) value;
+               }
+
+               public SqlDecimal GetSqlDecimal (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlDecimal.Null;
+                       if (!(value is TdsBigDecimal))
+                               throw new InvalidCastException ();
+                       return SqlDecimal.FromTdsBigDecimal ((TdsBigDecimal) value);
+               }
+
+               public SqlDouble GetSqlDouble (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlDouble.Null;
+                       if (!(value is double))
+                               throw new InvalidCastException ();
+                       return (double) value;
+               }
+
+               public SqlGuid GetSqlGuid (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlGuid.Null;
+                       if (!(value is Guid))
+                               throw new InvalidCastException ();
+                       return (Guid) value;
+               }
+
+               public SqlInt16 GetSqlInt16 (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlInt16.Null;
+                       if (!(value is short))
+                               throw new InvalidCastException ();
+                       return (short) value;
+               }
+
+               public SqlInt32 GetSqlInt32 (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlInt32.Null;
+                       if (!(value is int))
+                               throw new InvalidCastException ();
+                       return (int) value;
+               }
+
+               public SqlInt64 GetSqlInt64 (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlInt64.Null;
+                       if (!(value is long))
+                               throw new InvalidCastException ();
+                       return (long) value;
+               }
+
+               public SqlMoney GetSqlMoney (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlMoney.Null;
+                       if (!(value is TdsBigDecimal))
+                               throw new InvalidCastException ();
+                       return (SqlMoney) (SqlDecimal) value;
+               }
+
+               public SqlSingle GetSqlSingle (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlSingle.Null;
+                       if (!(value is float))
+                               throw new InvalidCastException ();
+                       return (float) value;
+               }
+
+               public SqlString GetSqlString (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return SqlString.Null;
+                       if (!(value is string))
+                               throw new InvalidCastException ();
+                       return (string) value;
+               }
+
+               [MonoTODO]
+               public object GetSqlValue (int i)
+               {
+                       object value = GetValue (i);
+                       if (value == null)
+                               return DBNull.Value; 
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public int GetSqlValues (object[] values)
+               {
+                       throw new NotImplementedException ();
+               }
+
                public string GetString (int i)
                {
                        object value = GetValue (i);
index e7c722285a925f0d797712a78c79f0d0dae0b281..2fa37621be05b8e2e1ae20061d888c406254110c 100644 (file)
@@ -11,12 +11,11 @@ using System;
 using System.Data;
 using System.Runtime.InteropServices;
 
-namespace System.Data.SqlClient
-{
+namespace System.Data.SqlClient {
        /// <summary>
        /// Describes an error from a SQL database.
        /// </summary>
-       [MonoTODO]
+       [Serializable]
        public sealed class SqlError
        {
                byte theClass = 0;
index 7050d5d08fa784c1a4f8cc0d63154697ad3c10d2..946252554cd7f52221856e84cd69aa1ffe33a86d 100644 (file)
 //
-// System.Data.SqlClient.SqlError.cs
+// System.Data.SqlClient.SqlErrorCollection.cs
 //
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
 //   Daniel Morgan (danmorg@sc.rr.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
 //
 using System;
 using System.Collections;
+using System.ComponentModel;
 using System.Data;
 using System.Runtime.InteropServices;
 
-namespace System.Data.SqlClient
-{
-       /// <summary>
-       /// Describes an error from a SQL database.
-       /// </summary>
-       [MonoTODO]
+namespace System.Data.SqlClient {
+       [ListBindable (false)]
+       [Serializable]
        public sealed class SqlErrorCollection : ICollection, IEnumerable
        {
-               ArrayList errorList = new ArrayList();
+               #region Fields
 
-               internal SqlErrorCollection() {
+               ArrayList list = new ArrayList();
+
+               #endregion // Fields
+
+               #region Constructors
+
+               internal SqlErrorCollection () 
+               {
                }
 
-               internal SqlErrorCollection(byte theClass, int lineNumber,
-                       string message, int number, string procedure,
-                       string server, string source, byte state) {
-                       
-                       Add (theClass, lineNumber, message,
-                               number, procedure,
-                               server, source, state);
+               internal SqlErrorCollection (byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state) 
+               {
+                       Add (theClass, lineNumber, message, number, procedure, server, source, state);
                }
 
+               #endregion // Constructors
+
                #region Properties
                 
-               [MonoTODO]
                public int Count {
-                       get {   
-                               return errorList.Count;
-                       }                         
+                       get { return list.Count; }                        
                }
 
-               [MonoTODO]
-               public void CopyTo(Array array, int index) {
-                       throw new NotImplementedException ();
-               }
-
-               // [MonoTODO]
                bool ICollection.IsSynchronized {
-                       get {   
-                               throw new NotImplementedException ();
-                       }                         
+                       get { return list.IsSynchronized; }
                }
 
-               // [MonoTODO]
                object ICollection.SyncRoot {
-                       get {   
-                               throw new NotImplementedException ();
-                       }                         
+                       get { return list.SyncRoot; }
                }
 
-               [MonoTODO]
-               public IEnumerator GetEnumerator() {
-                       throw new NotImplementedException ();
-               }
-               
-               // Index property (indexer)
-               // [MonoTODO]
                public SqlError this[int index] {
-                       get {
-                               return (SqlError) errorList[index];
-                       }
+                       get { return (SqlError) list [index]; }
                }
 
                #endregion
 
                #region Methods
                
-               [MonoTODO]
-               public override string ToString()
+               internal void Add(SqlError error) 
                {
-                       throw new NotImplementedException ();
+                       list.Add (error);
                }
-               #endregion
 
-               internal void Add(SqlError error) {
-                       errorList.Add(error);
+               internal void Add(byte theClass, int lineNumber, string message, int number, string procedure, string server, string source, byte state) 
+               {
+                       SqlError error = new SqlError (theClass, lineNumber, message, number, procedure, server, source, state);
+                       Add (error);
                }
 
-               internal void Add(byte theClass, int lineNumber,
-                       string message, int number, string procedure,
-                       string server, string source, byte state) {
-                       
-                       SqlError error = new SqlError(theClass,
-                               lineNumber, message,
-                               number, procedure,
-                               server, source, state);
-                       Add(error);
+               public void CopyTo (Array array, int index) 
+               {
+                       list.CopyTo (array, index);
                }
 
-               #region Destructors
+               public IEnumerator GetEnumerator() 
+               {
+                       return list.GetEnumerator ();
+               }
 
                [MonoTODO]
-               ~SqlErrorCollection()
+               public override string ToString()
                {
-                       // FIXME: do the destructor - release resources
+                       throw new NotImplementedException ();
                }
 
                #endregion              
index c4147c30170eafc8ea06470504351a1932d80175..3cc2376ee9d7f245f703abbda159877d909dcc5e 100644 (file)
@@ -12,6 +12,7 @@
 
 using Mono.Data.TdsClient.Internal;
 using System;
+using System.ComponentModel;
 using System.Data;
 using System.Runtime.Serialization;
 
@@ -19,9 +20,15 @@ namespace System.Data.SqlClient {
        [Serializable]
        public sealed class SqlException : SystemException
        {
-               private SqlErrorCollection errors; 
+               #region Fields
 
-               internal SqlException() 
+               SqlErrorCollection errors; 
+
+               #endregion // Fields
+
+               #region Constructors
+
+               internal SqlException () 
                        : base ("a SQL Exception has occurred.") 
                {
                        errors = new SqlErrorCollection();
@@ -33,6 +40,7 @@ namespace System.Data.SqlClient {
                        errors = new SqlErrorCollection (theClass, lineNumber, message, number, procedure, server, source, state);
                }
 
+               #endregion // Constructors
 
                #region Properties
 
@@ -44,14 +52,12 @@ namespace System.Data.SqlClient {
                                else
                                        return errors[0].Class;
                        }
-                       set { errors[0].SetClass(value); }
                }
 
                [MonoTODO]
-               public SqlErrorCollection Errors 
-               {
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+               public SqlErrorCollection Errors {
                        get { return errors; }
-                       set { errors = value; }
                }
 
                [MonoTODO]
@@ -60,7 +66,6 @@ namespace System.Data.SqlClient {
                                        return 0; // FIXME: throw exception here?
                                return errors[0].LineNumber;
                        }
-                       set { errors[0].SetLineNumber(value); }
                }
                
                [MonoTODO]
@@ -90,7 +95,6 @@ namespace System.Data.SqlClient {
                                else
                                        return errors[0].Number;
                        }
-                       set { errors[0].SetNumber(value); }
                }
                
                [MonoTODO]
@@ -101,7 +105,6 @@ namespace System.Data.SqlClient {
                                else
                                        return errors[0].Procedure;
                        }
-                       set { errors[0].SetProcedure(value); }
                }
 
                [MonoTODO]
@@ -112,7 +115,6 @@ namespace System.Data.SqlClient {
                                else
                                        return errors[0].Server;
                        }
-                       set { errors[0].SetServer(value); }
                }
                
                [MonoTODO]
@@ -123,7 +125,6 @@ namespace System.Data.SqlClient {
                                else
                                        return errors[0].Source;
                        }
-                       set { errors[0].SetSource(value); }
                }
 
                [MonoTODO]
@@ -134,7 +135,6 @@ namespace System.Data.SqlClient {
                                else
                                        return errors[0].State;
                        }
-                       set { errors[0].SetState(value); }
                }
 
                #endregion // Properties
@@ -142,7 +142,7 @@ namespace System.Data.SqlClient {
                #region Methods
 
                [MonoTODO]
-               public override void GetObjectData(SerializationInfo si, StreamingContext context) 
+               public override void GetObjectData (SerializationInfo si, StreamingContext context) 
                {
                        throw new NotImplementedException ();
                }
index 0249ee66b5b8185b152c9ba84c8681b9eb4dfe7f..f1a5aebed1cfef00bee282b8413f817d8bdd9fba 100644 (file)
@@ -14,6 +14,16 @@ using System.Data;
 namespace System.Data.SqlClient {
        public sealed class SqlInfoMessageEventArgs : EventArgs
        {
+               #region Constructors
+       
+               [MonoTODO]      
+               internal SqlInfoMessageEventArgs (SqlException e)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion // Constructors
+
                #region Properties
 
                [MonoTODO]
index cf4b40c0887fe027f68e29b46bba9da829939743..91736f39fc70c8fe09c854c39c10585f18148626 100644 (file)
@@ -24,7 +24,6 @@ namespace System.Data.SqlClient {
        /// </summary>
        public sealed class SqlParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
        {
-
                #region Fields
 
                string parmName;
@@ -46,48 +45,34 @@ namespace System.Data.SqlClient {
 
                #region Constructors
 
-               [MonoTODO]
                public SqlParameter () 
+                       : this (String.Empty, SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
                {
                }
 
-               [MonoTODO]
                public SqlParameter (string parameterName, object value) 
+                       : this (parameterName, SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, value)
                {
-                       this.parmName = parameterName;
-                       this.objValue = value;
                }
                
-               [MonoTODO]
                public SqlParameter (string parameterName, SqlDbType dbType) 
+                       : this (parameterName, dbType, 0, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
                {
-                       this.parmName = parameterName;
-                       this.dbtype = dbType;
                }
 
-               [MonoTODO]
                public SqlParameter (string parameterName, SqlDbType dbType, int size) 
+                       : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, null)
                {
-
-                       this.parmName = parameterName;
-                       this.dbtype = dbType;
-                       this.size = size;
                }
                
-               [MonoTODO]
-               public SqlParameter(string parameterName, SqlDbType dbType, int size, string sourceColumn) 
+               public SqlParameter (string parameterName, SqlDbType dbType, int size, string sourceColumn) 
+                       : this (parameterName, dbType, size, ParameterDirection.Input, false, 0, 0, sourceColumn, DataRowVersion.Current, null)
                {
-
-                       this.parmName = parameterName;
-                       this.dbtype = dbType;
-                       this.size = size;
-                       this.sourceColumn = sourceColumn;
                }
-                        
-               [MonoTODO]
-               public SqlParameter(string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) 
+               
+               [EditorBrowsable (EditorBrowsableState.Advanced)]        
+               public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) 
                {
-                       
                        this.parmName = parameterName;
                        this.dbtype = dbType;
                        this.size = size;
@@ -104,77 +89,96 @@ namespace System.Data.SqlClient {
 
                #region Properties
 
-               [MonoTODO]
+               [Browsable (false)]
+               [DataSysDescription ("The parameter generic type.")]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+               [RefreshProperties (RefreshProperties.All)]
                public DbType DbType {
                        get { return theDbType; }
                        set { theDbType = value; }
                }
 
-               [MonoTODO]
+               [DataSysDescription ("Input, output, or bidirectional parameter.")]
+               [DefaultValue (ParameterDirection.Input)]
                public ParameterDirection Direction {
                        get { return direction; }
                        set { direction = value; }
                }
 
-               [MonoTODO]
+               [Browsable (false)]
+               [DataSysDescription ("a design-time property used for strongly typed code-generation.")]
+               [DefaultValue (false)]
+               [DesignOnly (true)]
+               [EditorBrowsable (EditorBrowsableState.Advanced)]        
                public bool IsNullable  {
                        get { return isNullable; }
                }
 
-               [MonoTODO]
+               [Browsable (false)]
+               [DataSysDescription ("Offset in variable length data types.")]
+               [DefaultValue (0)]
                public int Offset {
                        get { return offset; }
                        set { offset = value; }
                }
-
                
                string IDataParameter.ParameterName {
                        get { return parmName; }
                        set { parmName = value; }
                }
-               
+       
+               [DataSysDescription ("Name of the parameter, like '@p1'")]
+               [DefaultValue ("")]
                public string ParameterName {
                        get { return parmName; }
                        set { parmName = value; }
                }
 
-               [MonoTODO]
+               [DataSysDescription ("For decimal, numeric, varnumeric DBTypes.")]
+               [DefaultValue (0)]
+               public byte Precision {
+                       get { return precision; }
+                       set { precision = value; }
+               }
+
+               [DataSysDescription ("When used by a DataAdapter.Update, the source column name that is used to find the DataSetColumn name in the ColumnMappings. This is to copy a value between the parameter and a datarow.")]
+               [DefaultValue ("")]
                public string SourceColumn {
                        get { return sourceColumn; }
                        set { sourceColumn = value; }
                }
 
-               [MonoTODO]
+               [DataSysDescription ("When used by a DataAdapter.Update (UpdateCommand only), the version of the DataRow value that is used to update the data source.")]
+               [DefaultValue (DataRowVersion.Current)]
                public DataRowVersion SourceVersion {
                        get { return sourceVersion; }
                        set { sourceVersion = value; }
                }
                
-               [MonoTODO]
+               [DataSysDescription ("The parameter native type.")]
+               [DefaultValue (SqlDbType.NVarChar)]
+               [RefreshProperties (RefreshProperties.All)]
                public SqlDbType SqlDbType {
                        get { return dbtype; }
                        set { dbtype = value; }
                }
 
-               [MonoTODO]
+               [DataSysDescription ("Value of the parameter.")]
+               [DefaultValue (null)]
                public object Value {
                        get { return objValue; }
                        set { objValue = value; }
                }
 
-               [MonoTODO]
-               public byte Precision {
-                       get { return precision; }
-                       set { precision = value; }
-               }
-
-               [MonoTODO]
+               [DataSysDescription ("For decimal, numeric, varnumeric DBTypes.")]
+               [DefaultValue (0)]
                 public byte Scale {
                        get { return scale; }
                        set { scale = value; }
                }
 
-               [MonoTODO]
+               [DataSysDescription ("Size of variable length datatypes (strings & arrays).")]
+               [DefaultValue (0)]
                 public int Size {
                        get { return size; }
                        set { 
index a0ddb4ba74c99887d1d051e3c83db8b05366ef61..c159d0e8b2b77e3226dd1caad4006a99c40114ad 100644 (file)
@@ -17,40 +17,112 @@ using System.Data.Common;
 using System.Collections;
 
 namespace System.Data.SqlClient {
-       /// <summary>
-       /// Collects all parameters relevant to a Command object 
-       /// and their mappings to DataSet columns.
-       /// </summary>
+       [ListBindable (false)]
        public sealed class SqlParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
        {
-               private ArrayList parameterList = new ArrayList();
+               #region Fields
 
-               public IEnumerator GetEnumerator()
+               ArrayList list = new ArrayList();
+               SqlCommand command;
+
+               #endregion // Fields
+
+               #region Constructors
+
+               internal SqlParameterCollection (SqlCommand command)
                {
-                       return parameterList.GetEnumerator ();
+                       this.command = command;
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               [Browsable (false)]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]      
+               public int Count {
+                       get { return list.Count; }                        
+               }
+
+               object IList.this [int index] {
+                       [MonoTODO]
+                       get { 
+                               return (SqlParameter) this[index];
+                       }
+                       
+                       [MonoTODO]
+                       set { 
+                               this[index] = (SqlParameter) value;
+                       }
+               }
+
+               [Browsable (false)]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]      
+               public SqlParameter this [int index] {
+                       get { return (SqlParameter) list[index]; }                        
+                       set { list[index] = (SqlParameter) value; }                       
                }
 
+               object IDataParameterCollection.this [string parameterName] {
+                       get { return this[parameterName]; }
+                       set { 
+                               CheckType(value);
+                               this[parameterName] = (SqlParameter) value;
+                       }
+               }
+
+               [Browsable (false)]
+               [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]      
+               public SqlParameter this [string parameterName] {
+                       get {
+                               foreach (SqlParameter p in list)
+                                       if (p.ParameterName.Equals (parameterName))
+                                               return p;
+                               throw new IndexOutOfRangeException ("The specified name does not exist: " + parameterName);
+                       }         
+                       set {   
+                               if (!Contains (parameterName))
+                                       throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
+                               this [IndexOf (parameterName)] = value;
+                       }                         
+               }
+
+
+               bool IList.IsFixedSize {
+                       get { throw new NotImplementedException (); }                     
+               }
+
+               bool IList.IsReadOnly {
+                       get { throw new NotImplementedException (); }                     
+               }
+
+               bool ICollection.IsSynchronized {
+                       get { throw new NotImplementedException (); }                     
+               }
+
+               object ICollection.SyncRoot {
+                       get { throw new NotImplementedException (); }                     
+               }
                
-               public int Add( object value)
+               #endregion // Properties
+
+               #region Methods
+
+               public int Add (object value)
                {
-                       // Call the add version that receives a SqlParameter 
-                       
                        // Check if value is a SqlParameter.
-                       CheckType(value);
-                       Add((SqlParameter) value);
-
+                       CheckType (value);
+                       Add ((SqlParameter) value);
                        return IndexOf (value);
                }
-
                
-               public SqlParameter Add(SqlParameter value)
+               public SqlParameter Add (SqlParameter value)
                {
-                       parameterList.Add(value);
+                       list.Add (value);
                        return value;
                }
-
                
-               public SqlParameter Add(string parameterName, object value)
+               public SqlParameter Add (string parameterName, object value)
                {
                        SqlParameter sqlparam = new SqlParameter();
                        sqlparam.Value = value;
@@ -59,7 +131,7 @@ namespace System.Data.SqlClient {
                        return Add(sqlparam);
                }
                
-               public SqlParameter Add(string parameterName, SqlDbType sqlDbType)
+               public SqlParameter Add (string parameterName, SqlDbType sqlDbType)
                {
                        SqlParameter sqlparam = new SqlParameter();
                        sqlparam.ParameterName = parameterName;
@@ -67,8 +139,7 @@ namespace System.Data.SqlClient {
                        return Add(sqlparam);                   
                }
 
-               public SqlParameter Add(string parameterName,
-                       SqlDbType sqlDbType, int size)
+               public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size)
                {
                        SqlParameter sqlparam = new SqlParameter();
                        sqlparam.ParameterName = parameterName;
@@ -78,39 +149,34 @@ namespace System.Data.SqlClient {
                }
 
                
-               public SqlParameter Add(string parameterName,
-                       SqlDbType sqlDbType, int size, string sourceColumn)
+               public SqlParameter Add (string parameterName, SqlDbType sqlDbType, int size, string sourceColumn)
                {
-                       SqlParameter sqlparam = new SqlParameter();
+                       SqlParameter sqlparam = new SqlParameter ();
                        sqlparam.ParameterName = parameterName;
                        sqlparam.SqlDbType = sqlDbType;
                        sqlparam.Size = size;
                        sqlparam.SourceColumn = sourceColumn;
-                       return Add(sqlparam);                   
+                       return Add (sqlparam);
                }
 
-               [MonoTODO]
                public void Clear()
                {
-                       throw new NotImplementedException ();
+                       list.Clear ();
                }
 
                
-               public bool Contains(object value)
+               public bool Contains (object value)
                {
-                       // Check if value is a SqlParameter
-                       CheckType(value);
-                       return Contains(((SqlParameter)value).ParameterName);
+                       CheckType (value);
+                       return Contains (((SqlParameter) value).ParameterName);
                }
 
 
-               [MonoTODO]
-               public bool Contains(string value)
+               public bool Contains (string value)
                {
-                       for(int p = 0; p < parameterList.Count; p++) {
-                               if(((SqlParameter)parameterList[p]).ParameterName.Equals(value))
+                       foreach (SqlParameter p in list)
+                               if (p.ParameterName.Equals (value))
                                        return true;
-                       }
                        return false;
                }
 
@@ -120,123 +186,42 @@ namespace System.Data.SqlClient {
                        throw new NotImplementedException ();
                }
 
+               public IEnumerator GetEnumerator()
+               {
+                       return list.GetEnumerator ();
+               }
                
                public int IndexOf (object value)
                {
-                       // Check if value is a SqlParameter
-                       CheckType(value);
-                       return IndexOf(((SqlParameter)value).ParameterName);
+                       CheckType (value);
+                       return IndexOf (((SqlParameter) value).ParameterName);
                }
-
                
                public int IndexOf (string parameterName)
                {
-                       return parameterList.IndexOf (parameterName);
+                       return list.IndexOf (parameterName);
                }
 
                public void Insert (int index, object value)
                {
-                       parameterList.Insert (index, value);
+                       list.Insert (index, value);
                }
 
                public void Remove (object value)
                {
-                       parameterList.Remove (value);
+                       list.Remove (value);
                }
 
                public void RemoveAt (int index)
                {
-                       parameterList.RemoveAt (index);
+                       list.RemoveAt (index);
                }
 
-               [MonoTODO]
                public void RemoveAt (string parameterName)
                {
-                       throw new NotImplementedException ();
-               }
-       
-               [MonoTODO]
-               public int Count {
-                       get { return parameterList.Count; }                       
-               }
-
-               object IList.this[int index] {
-                       [MonoTODO]
-                       get { 
-                               return (SqlParameter) this[index];
-                       }
-                       
-                       [MonoTODO]
-                       set { 
-                               this[index] = (SqlParameter) value;
-                       }
+                       RemoveAt (IndexOf (parameterName));
                }
 
-               public SqlParameter this[int index] {
-                       get {   
-                               return (SqlParameter) parameterList[index];
-                       }                         
-                       
-                       set {   
-                               parameterList[index] = (SqlParameter) value;
-                       }                         
-               }
-
-               object IDataParameterCollection.this[string parameterName] {
-                       [MonoTODO]
-                       get { 
-                               return this[parameterName];
-                       }
-                       
-                       [MonoTODO]
-                       set { 
-                               CheckType(value);
-                               this[parameterName] = (SqlParameter) value;
-                       }
-               }
-
-               public SqlParameter this[string parameterName] {
-                       get {   
-                               for(int p = 0; p < parameterList.Count; p++) {
-                                       if(parameterName.Equals(((SqlParameter)parameterList[p]).ParameterName))
-                                               return (SqlParameter) parameterList[p];
-                               }
-                               throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
-                       }         
-                       
-                       set {   
-                               for(int p = 0; p < parameterList.Count; p++) {
-                                       if(parameterName.Equals(((SqlParameter)parameterList[p]).ParameterName))
-                                               parameterList[p] = value;
-                               }
-                               throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
-                       }                         
-               }
-
-               bool IList.IsFixedSize {
-                       get {   
-                               throw new NotImplementedException ();
-                       }                         
-               }
-
-               bool IList.IsReadOnly {
-                       get {   
-                               throw new NotImplementedException ();
-                       }                         
-               }
-
-               bool ICollection.IsSynchronized {
-                       get {   
-                               throw new NotImplementedException ();
-                       }                         
-               }
-
-               object ICollection.SyncRoot {
-                       get {   
-                               throw new NotImplementedException ();
-                       }                         
-               }
-               
                /// <summary>
                /// This method checks if the parameter value is of 
                /// SqlParameter type. If it doesn't, throws an InvalidCastException.
@@ -246,6 +231,7 @@ namespace System.Data.SqlClient {
                        if(!(value is SqlParameter))
                                throw new InvalidCastException("Only SQLParameter objects can be used.");
                }
-               
+
+               #endregion // Methods   
        }
 }
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterConverter.cs
new file mode 100644 (file)
index 0000000..78c6827
--- /dev/null
@@ -0,0 +1,26 @@
+//
+// System.Data.SqlClient.SqlParameterConverter.cs
+//
+// Author:
+//   Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Data.SqlClient {
+       internal sealed class SqlParameterConverter : TypeConverter
+       {
+               #region Constructors
+
+               [MonoTODO]
+               public SqlParameterConverter ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               #endregion // Constructors
+       }
+}
index dbc5789aa95eb0b46b18a7a34885813c53241130..f3d11b83f6336a467e731baca73f23e325cece39 100644 (file)
@@ -4,8 +4,10 @@
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
 //   Daniel Morgan (danmorg@sc.rr.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System;
@@ -15,6 +17,8 @@ using System.Data.Common;
 namespace System.Data.SqlClient {
        public sealed class SqlRowUpdatedEventArgs : RowUpdatedEventArgs 
        {
+               #region Constructors
+
                [MonoTODO]
                public SqlRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) 
                        : base (row, command, statementType, tableMapping)
@@ -22,16 +26,15 @@ namespace System.Data.SqlClient {
                        throw new NotImplementedException ();
                }
 
+               #endregion // Constructors
+
+               #region Properties
+
                [MonoTODO]
                public new SqlCommand Command {
                        get { throw new NotImplementedException (); }
                }
 
-               [MonoTODO]
-               ~SqlRowUpdatedEventArgs () 
-               {
-                       throw new NotImplementedException ();
-               }
-
+               #endregion // Properties
        }
 }
index 6194ca1f95de75bbd8f59c5517f98293070ce4e8..80ec63c37371f5b5d57e865b0e37335b581196da 100644 (file)
@@ -4,18 +4,21 @@
 // Author:
 //   Rodrigo Moya (rodrigo@ximian.com)
 //   Daniel Morgan (danmorg@sc.rr.com)
+//   Tim Coleman (tim@timcoleman.com)
 //
 // (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
 //
 
 using System;
 using System.Data;
 using System.Data.Common;
 
-namespace System.Data.SqlClient
-{
+namespace System.Data.SqlClient {
        public sealed class SqlRowUpdatingEventArgs : RowUpdatingEventArgs
        {
+               #region Constructors
+
                [MonoTODO]
                public SqlRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) 
                        : base (row, command, statementType, tableMapping)
@@ -23,21 +26,16 @@ namespace System.Data.SqlClient
                        throw new NotImplementedException ();
                }
 
+               #endregion // Constructors
+
+               #region Properties
+
                [MonoTODO]
                public new SqlCommand Command {
-                       get {
-                               throw new NotImplementedException ();
-                       } 
-                       
-                       set {
-                               throw new NotImplementedException ();
-                       }
+                       get { throw new NotImplementedException (); } 
+                       set { throw new NotImplementedException (); }
                }
 
-               [MonoTODO]
-               ~SqlRowUpdatingEventArgs() 
-               {
-                       throw new NotImplementedException ();
-               }
+               #endregion // Properties
        }
 }
index 0f5b1bfa27759dfb2fd548b70171da48aa5131b7..9778bb1a5eccca4b7fb0ee4706534106e7ec6511 100644 (file)
@@ -39,7 +39,6 @@ namespace System.Data.SqlTypes
                public SqlDateTime (int dayTicks, int timeTicks) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                public SqlDateTime (int year, int month, int day) 
@@ -58,14 +57,12 @@ namespace System.Data.SqlTypes
                public SqlDateTime (int year, int month, int day, int hour, int minute, int second, double millisecond) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                [MonoTODO]
                public SqlDateTime (int year, int month, int day, int hour, int minute, int second, int bilisecond) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                #endregion
index 21114db717749f2327dbc5558040b6583ead8feb..0f67b2d1d5b8438e0e2ecd618c34dc1a38a27060 100644 (file)
@@ -7,6 +7,7 @@
 // (C) Copyright 2002 Tim Coleman
 //
 
+using Mono.Data.TdsClient.Internal;
 using System;
 using System.Globalization;
 
@@ -192,6 +193,14 @@ namespace System.Data.SqlTypes
                        throw new NotImplementedException ();
                }
 
+               internal static SqlDecimal FromTdsBigDecimal (TdsBigDecimal x)
+               {
+                       if (x == null)
+                               return Null;
+                       else
+                               return new SqlDecimal (x.Precision, x.Scale, !x.IsNegative, x.Data);
+               }
+
                public override int GetHashCode ()
                {
                        return (int)this.Value;
index c5ddfd149dd010078e6b0e8541500777151aaa67..f19e803917eb30d27d3c75e538d26ba512eedeab 100644 (file)
@@ -232,7 +232,7 @@ namespace System.Data.SqlTypes
 
                public static SqlInt16 operator | (SqlInt16 x, SqlInt16 y)
                {
-                       return new SqlInt16 ((short) (x.Value | y.Value));
+                       return new SqlInt16 ((short) ((byte) x.Value | (byte) y.Value));
                }
 
                public static SqlInt16 operator / (SqlInt16 x, SqlInt16 y)
index 71205c29d0ebb1adb2937a2454669c80d4dedf05..b6ec584b920e1bf999274ae867c0480103028bd5 100644 (file)
@@ -51,7 +51,6 @@ namespace System.Data.SqlTypes
                public SqlString (string data, int lcid) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                // init with locale id, compare options, 
@@ -60,7 +59,6 @@ namespace System.Data.SqlTypes
                public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                // init with string data, locale id, and compare options
@@ -68,7 +66,6 @@ namespace System.Data.SqlTypes
                public SqlString (string data, int lcid, SqlCompareOptions compareOptions) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                // init with locale id, compare options, array of bytes data,
@@ -77,7 +74,6 @@ namespace System.Data.SqlTypes
                public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data, bool fUnicode) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                // init with locale id, compare options, array of bytes data,
@@ -87,7 +83,6 @@ namespace System.Data.SqlTypes
                public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data, int index, int count) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                // init with locale id, compare options, array of bytes data,
@@ -97,7 +92,6 @@ namespace System.Data.SqlTypes
                public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data, int index, int count, bool fUnicode) 
                {
                        throw new NotImplementedException ();
-                       notNull = true;
                }
 
                #endregion // Constructors
diff --git a/mcs/class/System.Data/System.Data/DataSysDescriptionAttribute.cs b/mcs/class/System.Data/System.Data/DataSysDescriptionAttribute.cs
new file mode 100644 (file)
index 0000000..e6dd096
--- /dev/null
@@ -0,0 +1,41 @@
+// 
+// System.Data/DataSysDescriptionAttribute.cs
+//
+// Author:
+//   Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Data {
+       [AttributeUsage (AttributeTargets.All)]
+       public class DataSysDescriptionAttribute : DescriptionAttribute
+       {
+               #region Fields
+
+               string description;
+
+               #endregion // Fields
+
+               #region Constructors
+
+               public DataSysDescriptionAttribute (string description)
+                       : base (description)
+               {
+                       this.description = description; 
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public override string Description {
+                       get { return description; }
+               }
+
+               #endregion // Properties
+       }
+}
index 258922d584d2e6220cb9930b7bfcfafe091b53ac..ba96c2e9c915640c73b4c21b08e4312d58aaa54f 100755 (executable)
@@ -22,6 +22,7 @@ System.Data/DataRowState.cs
 System.Data/DataRowVersion.cs
 System.Data/DataRowView.cs
 System.Data/DataSet.cs
+System.Data/DataSysDescriptionAttribute.cs
 System.Data/DataTable.cs
 System.Data/DataTableCollection.cs
 System.Data/DataView.cs
@@ -168,6 +169,7 @@ System.Data.SqlClient/SqlInfoMessageEventArgs.cs
 System.Data.SqlClient/SqlInfoMessageEventHandler.cs
 System.Data.SqlClient/SqlParameter.cs
 System.Data.SqlClient/SqlParameterCollection.cs
+System.Data.SqlClient/SqlParameterConverter.cs
 System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
 System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
 System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
@@ -177,6 +179,7 @@ System.Data.SqlClient/SqlXmlTextReader.cs
 ../Mono.Data.TdsClient/Mono.Data.TdsClient.Internal/ITds.cs
 ../Mono.Data.TdsClient/Mono.Data.TdsClient.Internal/Tds.cs
 ../Mono.Data.TdsClient/Mono.Data.TdsClient.Internal/Tds70.cs
+../Mono.Data.TdsClient/Mono.Data.TdsClient.Internal/TdsBigDecimal.cs
 ../Mono.Data.TdsClient/Mono.Data.TdsClient.Internal/TdsColumnStatus.cs
 ../Mono.Data.TdsClient/Mono.Data.TdsClient.Internal/TdsColumnType.cs
 ../Mono.Data.TdsClient/Mono.Data.TdsClient.Internal/TdsComm.cs