Author: suresh
Date: 2005-03-02 23:30:14 -0500 (Wed, 02 Mar 2005)
New Revision: 41382
Added:
trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs
Modified:
trunk/mcs/class/System.Data/ChangeLog
trunk/mcs/class/System.Data/System.Data.ProviderBase/ChangeLog
trunk/mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs
trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
trunk/mcs/class/System.Data/System.Data.SqlClient/SqlClientFactory.cs
trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
trunk/mcs/class/System.Data/System.Data.dll.sources
Log:
In System.Data.ProviderBase:
2005-03-02 Sureshkumar T <[EMAIL PROTECTED]>
* DbConnectionBase.cs: CreateDbCommand: assign connection to the
created command.
In .:
2005-03-02 Sureshkumar T <[EMAIL PROTECTED]>
* System.Data.dll.sources: Added
System.Data.SqlClient/SqlConnectionFactory.cs.
In System.Data.SqlClient:
2005-03-03 Sureshkumar T <[EMAIL PROTECTED]>
* 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.
Modified: trunk/mcs/class/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/ChangeLog 2005-03-03 04:27:41 UTC (rev
41381)
+++ trunk/mcs/class/System.Data/ChangeLog 2005-03-03 04:30:14 UTC (rev
41382)
@@ -1,3 +1,8 @@
+2005-03-02 Sureshkumar T <[EMAIL PROTECTED]>
+
+ * System.Data.dll.sources: Added
+ System.Data.SqlClient/SqlConnectionFactory.cs.
+
2005-03-01 Sureshkumar T <[EMAIL PROTECTED]>
* System.Data.dll.sources: Added System.Data.Common/
Modified: trunk/mcs/class/System.Data/System.Data.ProviderBase/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data.ProviderBase/ChangeLog
2005-03-03 04:27:41 UTC (rev 41381)
+++ trunk/mcs/class/System.Data/System.Data.ProviderBase/ChangeLog
2005-03-03 04:30:14 UTC (rev 41382)
@@ -1,3 +1,8 @@
+2005-03-02 Sureshkumar T <[EMAIL PROTECTED]>
+
+ * DbConnectionBase.cs: CreateDbCommand: assign connection to the
+ created command.
+
2005-02-02 Sureshkumar T <[EMAIL PROTECTED]>
* DbConnectionBase.cs: Implement Dispose Pattern
Modified:
trunk/mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs
2005-03-03 04:27:41 UTC (rev 41381)
+++ trunk/mcs/class/System.Data/System.Data.ProviderBase/DbConnectionBase.cs
2005-03-03 04:30:14 UTC (rev 41382)
@@ -155,7 +155,9 @@
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)
Modified: trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog 2005-03-03
04:27:41 UTC (rev 41381)
+++ trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog 2005-03-03
04:30:14 UTC (rev 41382)
@@ -1,3 +1,15 @@
+2005-03-03 Sureshkumar T <[EMAIL PROTECTED]>
+
+ * 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 <[EMAIL PROTECTED]>
* SqlDataReader.cs: GetBytes: return the length of the data if
Modified: trunk/mcs/class/System.Data/System.Data.SqlClient/SqlClientFactory.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.SqlClient/SqlClientFactory.cs
2005-03-03 04:27:41 UTC (rev 41381)
+++ trunk/mcs/class/System.Data/System.Data.SqlClient/SqlClientFactory.cs
2005-03-03 04:30:14 UTC (rev 41382)
@@ -32,6 +32,7 @@
{
using System.Data;
using System.Data.Common;
+ using System.Data.ProviderBase;
public class SqlClientFactory : DbProviderFactory
{
@@ -70,7 +71,8 @@
public override DbConnection CreateConnection ()
{
- SqlConnection connection = new SqlConnection ();
+ DbConnectionFactory connFactory =
SqlConnectionFactory.GetSingleton (Instance /* provider factory */);
+ SqlConnection connection = new SqlConnection
(connFactory);
return (DbConnection) connection;
}
Modified: trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
2005-03-03 04:27:41 UTC (rev 41381)
+++ trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
2005-03-03 04:30:14 UTC (rev 41382)
@@ -112,12 +112,26 @@
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
Added: trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs
2005-03-03 04:27:41 UTC (rev 41381)
+++ trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs
2005-03-03 04:30:14 UTC (rev 41382)
@@ -0,0 +1,144 @@
+//
+// System.Data.SqlClient.SqlConnectionFactory
+//
+// Author:
+// Sureshkumar T <[EMAIL PROTECTED]>
+//
+//
+// 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
Property changes on:
trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionFactory.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/mcs/class/System.Data/System.Data.dll.sources
===================================================================
--- trunk/mcs/class/System.Data/System.Data.dll.sources 2005-03-03 04:27:41 UTC
(rev 41381)
+++ trunk/mcs/class/System.Data/System.Data.dll.sources 2005-03-03 04:30:14 UTC
(rev 41382)
@@ -314,6 +314,9 @@
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/Like.cs
Mono.Data.SqlExpressions/In.cs
Mono.Data.SqlExpressions/Aggregation.cs
-System.Data.SqlClient/SqlClientFactory.cs
-System.Data.SqlClient/SqlDataSourceEnumerator.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches