In System.Data.ProviderBase:
authorSureshkumar T <suresh@mono-cvs.ximian.com>
Thu, 3 Mar 2005 04:30:14 +0000 (04:30 -0000)
committerSureshkumar T <suresh@mono-cvs.ximian.com>
Thu, 3 Mar 2005 04:30:14 +0000 (04:30 -0000)
2005-03-02  Sureshkumar T  <tsureshkumar@novell.com>

* DbConnectionBase.cs: CreateDbCommand: assign connection to the
created command.

In .:
2005-03-02  Sureshkumar T  <tsureshkumar@novell.com>

* System.Data.dll.sources: Added
System.Data.SqlClient/SqlConnectionFactory.cs.

In System.Data.SqlClient:
2005-03-03  Sureshkumar T  <tsureshkumar@novell.com>

* SqlClientFactory.cs: While creating command, create using
DbConnectionFactory as DbConnectionBase.CreateDbCommand needs to
have a connection factory.

* SqlConnection.cs: Added an internal constructor which takes
DbConnectionFactory.

* SqlConnectionFactory.cs: Added. Concrete class for abstract
factory DbConnectionFactory.

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

mcs/class/System.Data/ChangeLog
mcs/class/System.Data/System.Data.ProviderBase/ChangeLog
mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs
mcs/class/System.Data/System.Data.SqlClient/ChangeLog
mcs/class/System.Data/System.Data.SqlClient/SqlClientFactory.cs
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.dll.sources

index a937bc2736344c068bb5981e87adc2ab3d1ca207..832cf789531a5d4130c99489947294a58ee31f52 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-02  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * System.Data.dll.sources: Added
+       System.Data.SqlClient/SqlConnectionFactory.cs.
+
 2005-03-01  Sureshkumar T  <tsureshkumar@novell.com>
 
        * System.Data.dll.sources: Added System.Data.Common/
index 88301fc8e76ea60030f76f6d5a99addff6fb37c5..9d1a83022be475a9a032396e8ccdc2fa53593ef7 100755 (executable)
@@ -1,3 +1,8 @@
+2005-03-02  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * DbConnectionBase.cs: CreateDbCommand: assign connection to the
+       created command.
+
 2005-02-02  Sureshkumar T  <tsureshkumar@novell.com>
 
        * DbConnectionBase.cs: Implement Dispose Pattern
index 377432bb4e5bf079b96c6828bdb483841cb05bec..b88ffc583be0fc49da360e56625e2f67aa2ecf04 100644 (file)
@@ -155,7 +155,9 @@ namespace System.Data.ProviderBase {
 
                protected override DbCommand CreateDbCommand ()
                {
-                       return (DbCommand) ConnectionFactory.ProviderFactory.CreateCommand ();
+                       DbCommand cmd = (DbCommand) ConnectionFactory.ProviderFactory.CreateCommand ();
+                        cmd.Connection = this;
+                        return cmd;
                }
 
                protected override void Dispose (bool disposing)
index ceaebe93eac807d1cc43d30f52e2178320698803..f8565017b9d3898f14835d98981d3cda88ab56dc 100755 (executable)
@@ -1,3 +1,15 @@
+2005-03-03  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * SqlClientFactory.cs: While creating command, create using
+       DbConnectionFactory as DbConnectionBase.CreateDbCommand needs to
+       have a connection factory.
+
+       * SqlConnection.cs: Added an internal constructor which takes
+       DbConnectionFactory.
+
+       * SqlConnectionFactory.cs: Added. Concrete class for abstract
+       factory DbConnectionFactory.
+
 2005-02-22  Sureshkumar T  <tsureshkumar@novell.com>
 
        * SqlDataReader.cs: GetBytes: return the length of the data if
index 746a8b2ad9b84d23f1bdfedb9f9034dae984b137..b3b3dfff83dcb7031c909a45463acd91c592b530 100644 (file)
@@ -32,6 +32,7 @@ namespace System.Data.SqlClient
 {
         using System.Data;
         using System.Data.Common;
+        using System.Data.ProviderBase;
         
         public class SqlClientFactory : DbProviderFactory
         {
@@ -70,7 +71,8 @@ namespace System.Data.SqlClient
 
                 public override DbConnection CreateConnection ()
                 {
-                        SqlConnection connection = new SqlConnection ();
+                        DbConnectionFactory connFactory = SqlConnectionFactory.GetSingleton (Instance /* provider factory */);
+                        SqlConnection connection = new SqlConnection (connFactory);
                         return (DbConnection) connection;
                 }
                 
index c73d1816e044b409c267dbcc5fa2e065293e3671..456a6c0a3407e9d9c0d31fd9443fbc66525d4e75 100644 (file)
@@ -112,12 +112,26 @@ namespace System.Data.SqlClient {
        
                public SqlConnection (string connectionString)
                {
+                        Init (connectionString);
+               }
+
+#if NET_2_0
+                internal SqlConnection (DbConnectionFactory connectionFactory) : base (connectionFactory)
+                {
+                        Init (String.Empty);
+                }
+
+#endif //NET_2_0
+
+                private void Init (string connectionString)
+                {
                         connectionTimeout       = 15; // default timeout
                         dataSource              = ""; // default datasource
                         packetSize              = 8192; // default packetsize
+                        ConnectionString        = connectionString;
+                }
+                
 
-                       ConnectionString        = connectionString;
-               }
 
                #endregion // Constructors
 
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs
new file mode 100644 (file)
index 0000000..626fe1c
--- /dev/null
@@ -0,0 +1,144 @@
+//
+// System.Data.SqlClient.SqlConnectionFactory
+//
+// Author:
+//   Sureshkumar T <tsureshkumar@novell.com>
+//
+//
+// Copyright (C) 2005 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.Data;
+using System.Data.Common;
+using System.Data.ProviderBase;
+
+namespace System.Data.SqlClient {
+       internal class SqlConnectionFactory : DbConnectionFactory
+       {
+               #region Fields
+               internal static SqlConnectionFactory Instance; // singleton
+                private static DbProviderFactory _providerFactory;
+               #endregion // Fields
+
+               #region Constructors
+
+               private SqlConnectionFactory (DbProviderFactory pvdrfactory)
+               {
+                        _providerFactory = pvdrfactory;
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public override DbProviderFactory ProviderFactory { get { return _providerFactory; }}
+
+               #endregion // Properties
+
+               #region Methods
+
+                // create singleton connection factory.
+                internal static DbConnectionFactory GetSingleton (DbProviderFactory pvdrFactory)
+                {
+                        lock (typeof (SqlConnectionFactory)) 
+                                {
+                                        if (Instance == null)
+                                                Instance = new SqlConnectionFactory (pvdrFactory);
+                                        return Instance;
+                                }
+                }
+                
+
+
+               [MonoTODO]
+                protected override IAsyncResult BeginCreateConnection (DbConnectionBase owningObject, DbConnectionString connectionOptions, DbConnectionInternal connection, AsyncCallback callback, object asyncStateObject)
+                {
+                        throw new NotImplementedException ();
+                }
+
+               [MonoTODO]
+                public new void ClearAllPools ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+               [MonoTODO]
+                public new void ClearPool (DbConnectionBase connection)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                [MonoTODO]
+               protected override DbConnectionInternal CreateConnection (DbConnectionString options, DbConnectionBase owningObject)
+                {
+                        throw new NotImplementedException ();
+                }
+                
+                [MonoTODO]
+               protected override DbConnectionString CreateConnectionOptions (string connectionString)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                [MonoTODO]
+               protected override DbConnectionPoolOptions CreateConnectionPoolOptions (DbConnectionString options)
+                {
+                        throw new NotImplementedException ();
+                }
+
+
+               [MonoTODO]
+                protected override DbMetaDataFactory CreateMetaDataFactory (DbConnectionInternal internalConnection)
+                {
+                        throw new NotImplementedException ();
+                }
+
+               [MonoTODO]
+                protected override DbConnectionInternal EndCreateConnection (IAsyncResult asyncResult)
+                {
+                        throw new NotImplementedException ();
+                }
+
+               [MonoTODO]
+                protected internal new DbMetaDataFactory GetMetaDataFactory (DbConnectionString connectionOptions, DbConnectionInternal internalConnection)
+                {
+                        throw new NotImplementedException ();
+                }
+
+               internal new DbConnectionString CreateConnectionOptionsInternal (string connectionString)
+                {
+                        return CreateConnectionOptions (connectionString);
+                }
+
+               [MonoTODO]
+                public new void SetConnectionPoolOptions (string connectionString, DbConnectionPoolOptions poolOptions)
+                {
+                        throw new NotImplementedException ();
+                }
+
+               #endregion // Methods
+        }
+}
+
+#endif
index 3d4400c28589dc12df0251b6c07b79c6c621f578..69dd75a57c17e517427aeed707aef1b2ed720d17 100755 (executable)
@@ -314,6 +314,9 @@ System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
 System.Data.SqlClient/SqlTransaction.cs
 System.Data.SqlClient/SqlXmlTextReader.cs
 System.Data.SqlClient/SQLDebugging.cs
+System.Data.SqlClient/SqlClientFactory.cs
+System.Data.SqlClient/SqlConnectionFactory.cs
+System.Data.SqlClient/SqlDataSourceEnumerator.cs
 System.Data/XmlDataLoader.cs
 System.Data/XmlSchemaDataImporter.cs
 System.Data/XmlSchemaWriter.cs
@@ -342,5 +345,3 @@ Mono.Data.SqlExpressions/Functions.cs
 Mono.Data.SqlExpressions/Like.cs
 Mono.Data.SqlExpressions/In.cs
 Mono.Data.SqlExpressions/Aggregation.cs
-System.Data.SqlClient/SqlClientFactory.cs
-System.Data.SqlClient/SqlDataSourceEnumerator.cs