Преглед на файлове

2007-09-25 Nagappan A <[email protected]>

	* SqlInitialCatalogConverter.cs, SqlDataSourceConverter.cs:
	NetworkLibraryConverter.cs: Added new files.

	* SqlParameter.cs: 2.0 attribute changes.

	* SqlDataAdapter.cs: 2.0 attribute changes.

	* SqlConnectionStringBuilder.cs: 2.0 attribute changes.

	* SqlConnection.cs (ClearAllPools, ClearPool): Implemented 2.0
	APIs, other 2.0 attribute changes.

	* SqlCommandBuilder.cs (GetSchemaTable, InitializeCommand):
	Implemented 2.0 APIs, other 2.0 attribute changes.

	* SqlBulkCopyColumnMappingCollection.cs: Added constructor, 2.0
	API compatibility changes.

	* SqlException.cs: 2.0 attribute changes.


svn path=/trunk/mcs/; revision=86297
Nagappan Alagappan преди 18 години
родител
ревизия
66cf8bc111

+ 22 - 0
mcs/class/System.Data/System.Data.SqlClient/ChangeLog

@@ -1,3 +1,25 @@
+2007-09-25  Nagappan A  <[email protected]>
+
+	* SqlInitialCatalogConverter.cs, SqlDataSourceConverter.cs:
+	NetworkLibraryConverter.cs: Added new files.
+
+	* SqlParameter.cs: 2.0 attribute changes.
+
+	* SqlDataAdapter.cs: 2.0 attribute changes.
+
+	* SqlConnectionStringBuilder.cs: 2.0 attribute changes.
+
+	* SqlConnection.cs (ClearAllPools, ClearPool): Implemented 2.0
+	APIs, other 2.0 attribute changes.
+
+	* SqlCommandBuilder.cs (GetSchemaTable, InitializeCommand):
+	Implemented 2.0 APIs, other 2.0 attribute changes.
+
+	* SqlBulkCopyColumnMappingCollection.cs: Added constructor, 2.0
+	API compatibility changes.
+
+	* SqlException.cs: 2.0 attribute changes.
+
 2007-08-13  Nagappan A  <[email protected]>
 
 	* SqlConnection.cs (ConnectionString): 2.0 compatibility changes.

+ 65 - 0
mcs/class/System.Data/System.Data.SqlClient/NetworkLibraryConverter.cs

@@ -0,0 +1,65 @@
+//
+// System.Data.SqlClient.NetworkLibraryConverter.cs
+//
+// Author:
+//   Nagappan A ([email protected])
+//
+
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_2_0
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Data.SqlClient {
+	internal sealed class NetworkLibraryConverter : ExpandableObjectConverter
+	{
+		#region Constructors
+
+		[MonoTODO]
+		public NetworkLibraryConverter ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		#endregion // Constructors
+
+		#region Methods
+	
+		[MonoTODO]
+		public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+		{
+			throw new NotImplementedException ();
+		}
+
+		#endregion // Methods
+	}
+}
+#endif

+ 10 - 0
mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopyColumnMappingCollection.cs

@@ -39,6 +39,16 @@ namespace System.Data.SqlClient
 {
 	public sealed class SqlBulkCopyColumnMappingCollection : CollectionBase {
 
+		#region Constructors
+
+		internal SqlBulkCopyColumnMappingCollection () 
+		{
+			// Do nothing - Created the constructor as the class status page
+			// was reporting extra constructor which gets generated by default
+		}
+
+		#endregion // Constructors
+
 		public SqlBulkCopyColumnMapping this [int value] {
 			get {
 				if (value < 0 || value > base.Count)

+ 1 - 1
mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs

@@ -290,7 +290,7 @@ namespace System.Data.SqlClient {
 #if NET_2_0
 		override
 #endif // NET_2_0
-		UpdateRowSource UpdatedRowSource	{
+		UpdateRowSource UpdatedRowSource {
 			get { return updatedRowSource; }
 			set { 
 				if (!Enum.IsDefined (typeof (UpdateRowSource), value))

+ 27 - 7
mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs

@@ -491,10 +491,12 @@ namespace System.Data.SqlClient {
 			command.DeriveParameters ();
 		}
 
-#if NET_1_0
-		protected
+#if NET_2_0
+		new
+#else
+		protected override
 #endif
-		new void Dispose (bool disposing)
+		void Dispose (bool disposing)
 		{
 			if (!disposed) {
 				if (disposing) {
@@ -637,10 +639,10 @@ namespace System.Data.SqlClient {
 			return true;
 		}
 
-#if NET_1_0
-		public
-#else
+#if NET_2_0
 		new
+#else
+		public
 #endif
 		void RefreshSchema () 
 		{
@@ -720,9 +722,27 @@ namespace System.Data.SqlClient {
 			rowUpdatingHandler = new SqlRowUpdatingEventHandler (RowUpdatingHandler);
 			((SqlDataAdapter) adapter).RowUpdating += rowUpdatingHandler;
                 }
+
+		protected override DataTable GetSchemaTable (DbCommand cmd)
+		{
+			using (SqlDataReader rdr = (SqlDataReader) cmd.ExecuteReader ())
+				return rdr.GetSchemaTable ();
+		}
+
+		protected override DbCommand InitializeCommand (DbCommand cmd)
+		{
+			if (cmd == null) {
+				cmd = new SqlCommand ();
+			} else {
+				cmd.CommandTimeout = 30;
+				cmd.Transaction = null;
+				cmd.CommandType = CommandType.Text;
+				cmd.UpdatedRowSource = UpdateRowSource.None;
+			}
+			return cmd;
+		}
 #endif // NET_2_0
 
 		#endregion // Event Handlers
 	}
 }
-

+ 28 - 2
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs

@@ -398,8 +398,12 @@ namespace System.Data.SqlClient {
 			}
 
 			if (tds != null && tds.IsConnected) {
-				if (pooling) {
+				if (pooling && tds.Pooling) {
+#if NET_2_0
+					if(pool != null) pool.ReleaseConnection (ref tds);
+#else
 					if(pool != null) pool.ReleaseConnection (tds);
+#endif
 				}else
 					if(tds != null) tds.Disconnect ();
 			}
@@ -1565,6 +1569,28 @@ namespace System.Data.SqlClient {
 								 conn.parms.Password, newPassword, conn.parms.User));
 			}
 		}
+
+		public static void ClearAllPools ()
+		{
+			Hashtable pools = SqlConnection.sqlConnectionPools.GetConnectionPool ();
+			foreach (TdsConnectionPool pool in pools.Values) {
+				if (pool != null) {
+					pool.ResetConnectionPool ();
+					ITds tds = pool.GetConnection ();
+					tds.Pooling = false;
+				}
+			}
+		}
+
+		public static void ClearPool (SqlConnection connection)
+		{
+			if (connection.pooling) {
+				connection.pooling = false;
+				if (connection.pool != null)
+					connection.pool.ResetConnectionPool (connection.Tds);
+			}
+		}
+
 #endif // NET_2_0
 
 		#endregion // Methods
@@ -1578,7 +1604,7 @@ namespace System.Data.SqlClient {
 
 		#region Properties Net 2
 
-#if !NET_2_0
+#if NET_1_0
 		[DataSysDescription ("Enable Asynchronous processing, 'Asynchrouse Processing=true/false' in the ConnectionString.")]	
 #endif
 		[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]

+ 20 - 0
mcs/class/System.Data/System.Data.SqlClient/SqlConnectionStringBuilder.cs

@@ -40,6 +40,9 @@ using System.ComponentModel;
 namespace System.Data.SqlClient
 {
 	[DefaultPropertyAttribute ("DataSource")]
+#if NET_2_0
+	[TypeConverterAttribute ("System.Data.SqlClient.SqlConnectionStringBuilder+SqlConnectionStringBuilderConverter, " + Consts.AssemblySystem_Data)]
+#endif
 	public sealed class SqlConnectionStringBuilder : DbConnectionStringBuilder
 	{
 
@@ -187,8 +190,13 @@ namespace System.Data.SqlClient
 			}
 		}
 
+#if NET_2_0
+		[Editor ("System.Windows.Forms.Design.FileNameEditor, " + Consts.AssemblySystem_Design,
+			 "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+#else
 		[Editor ("Microsoft.VSDesigner.Data.Design.DBParametersEditor, " + Consts.AssemblyMicrosoft_VSDesigner,
 			 "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+#endif
 		[DisplayNameAttribute ("AttachDbFilename")]
 		[RefreshPropertiesAttribute (RefreshProperties.All)]
 		public string AttachDBFilename { 
@@ -231,6 +239,9 @@ namespace System.Data.SqlClient
 
 		[DisplayNameAttribute ("Data Source")]
 		[RefreshPropertiesAttribute (RefreshProperties.All)]
+#if NET_2_0
+		[TypeConverterAttribute ("System.Data.SqlClient.SqlConnectionStringBuilder+SqlDataSourceConverter, " + Consts.AssemblySystem_Data)]
+#endif
 		public string DataSource { 
 			get { return _dataSource; }
 			set { 
@@ -261,6 +272,9 @@ namespace System.Data.SqlClient
 
 		[DisplayNameAttribute ("Failover Partner")]
 		[RefreshPropertiesAttribute (RefreshProperties.All)]
+#if NET_2_0
+		[TypeConverterAttribute ("System.Data.SqlClient.SqlConnectionStringBuilder+SqlDataSourceConverter, " + Consts.AssemblySystem_Data)]
+#endif
 		public string FailoverPartner { 
 			get { return _failoverPartner; }
 			set { 
@@ -271,6 +285,9 @@ namespace System.Data.SqlClient
 
 		[DisplayNameAttribute ("Initial Catalog")]
 		[RefreshPropertiesAttribute (RefreshProperties.All)]
+#if NET_2_0
+		[TypeConverterAttribute ("System.Data.SqlClient.SqlConnectionStringBuilder+SqlInitialCatalogConverter, " + Consts.AssemblySystem_Data)]
+#endif
 		public string InitialCatalog { 
 			get { return _initialCatalog; }
 			set { 
@@ -347,6 +364,9 @@ namespace System.Data.SqlClient
 
 		[DisplayNameAttribute ("Network Library")]
 		[RefreshPropertiesAttribute (RefreshProperties.All)]
+#if NET_2_0
+		[TypeConverterAttribute ("System.Data.SqlClient.SqlConnectionStringBuilder+NetworkLibraryConverter, " + Consts.AssemblySystem_Data)]
+#endif
 		public string NetworkLibrary { 
 			get { return _networkLibrary; }
 			set { 

+ 42 - 2
mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs

@@ -227,16 +227,56 @@ namespace System.Data.SqlClient {
 			throw new NotImplementedException ();
 		}
 
+#if NET_2_0
+		// All the batch methods, should be implemented, if supported,
+		// by individual providers 
+
+		[MonoTODO]
+		protected override int AddToBatch (IDbCommand cmd)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override void ClearBatch ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override int ExecuteBatch ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override IDataParameter GetBatchedParameter (int commandIdentifier, int parameterIdentifer)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override void InitializeBatching ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override void TerminateBatching ()
+		{
+			throw new NotImplementedException ();
+		}
+#endif
 		#endregion // Methods
 
 		#region Events and Delegates
 
-#if !NET_2_0
+#if ONLY_1_1
 		[DataSysDescription ("Event triggered before every DataRow during Update.")]
 #endif
 		public event SqlRowUpdatedEventHandler RowUpdated;
 
-#if !NET_2_0
+#if ONLY_1_1
 		[DataSysDescription ("Event triggered after every DataRow during Update.")]
 #endif
 		public event SqlRowUpdatingEventHandler RowUpdating;

+ 65 - 0
mcs/class/System.Data/System.Data.SqlClient/SqlDataSourceConverter.cs

@@ -0,0 +1,65 @@
+//
+// System.Data.SqlClient.SqlDataSourceConverter.cs
+//
+// Author:
+//   Nagappan A ([email protected])
+//
+
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_2_0
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Data.SqlClient {
+	internal sealed class SqlDataSourceConverter : ExpandableObjectConverter
+	{
+		#region Constructors
+
+		[MonoTODO]
+		public SqlDataSourceConverter ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		#endregion // Constructors
+
+		#region Methods
+	
+		[MonoTODO]
+		public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+		{
+			throw new NotImplementedException ();
+		}
+
+		#endregion // Methods
+	}
+}
+#endif

+ 1 - 1
mcs/class/System.Data/System.Data.SqlClient/SqlException.cs

@@ -109,7 +109,7 @@ namespace System.Data.SqlClient {
 			get { return Errors [0].LineNumber; }
 		}
 		
-#if NET_1_0 || NET_1_1
+#if NET_1_0 || ONLY_1_1
 		public
 		override
 #else

+ 65 - 0
mcs/class/System.Data/System.Data.SqlClient/SqlInitialCatalogConverter.cs

@@ -0,0 +1,65 @@
+//
+// System.Data.SqlClient.SqlInitialCatalogConverter.cs
+//
+// Author:
+//   Nagappan A ([email protected])
+//
+
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+#if NET_2_0
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Data.SqlClient {
+	internal sealed class SqlInitialCatalogConverter : ExpandableObjectConverter
+	{
+		#region Constructors
+
+		[MonoTODO]
+		public SqlInitialCatalogConverter ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		#endregion // Constructors
+
+		#region Methods
+	
+		[MonoTODO]
+		public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+		{
+			throw new NotImplementedException ();
+		}
+
+		#endregion // Methods
+	}
+}
+#endif

+ 2 - 1
mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs

@@ -47,10 +47,11 @@ using System.Runtime.InteropServices;
 using System.Text;
 
 namespace System.Data.SqlClient {
-	[TypeConverterAttribute (typeof (SqlParameterConverter))]
 #if NET_2_0
+	[TypeConverterAttribute ("System.Data.SqlClient.SqlParameter+SqlParameterConverter, " + Consts.AssemblySystem_Data)]
 	public sealed class SqlParameter : DbParameter, IDbDataParameter, IDataParameter, ICloneable
 #else
+	[TypeConverterAttribute (typeof (SqlParameterConverter))]
 	public sealed class SqlParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
 #endif // NET_2_0
 	{