浏览代码

2002-10-27 Rodrigo Moya <[email protected]>

	* System.Data.OleDb/OleDbDataAdapter.cs (Fill, FillSchema,
	GetFillParameters, Update): added overloaded methods.

	* System.Data.OleDb/OleDbCommand.cs:
	* System.Data.OleDb/OleDbDataReader.cs:
	* System.Data.OleDb/OleDbConnection.cs: removed limitation of one
	data adapter at a time. Mono's version can open as many as you want,
	for free.

svn path=/trunk/mcs/; revision=8616
Rodrigo Moya 23 年之前
父节点
当前提交
5ae39b1746

+ 11 - 0
mcs/class/System.Data/ChangeLog

@@ -1,3 +1,14 @@
+2002-10-27  Rodrigo Moya <[email protected]>
+
+	* System.Data.OleDb/OleDbDataAdapter.cs (Fill, FillSchema,
+	GetFillParameters, Update): added overloaded methods.
+
+	* System.Data.OleDb/OleDbCommand.cs:
+	* System.Data.OleDb/OleDbDataReader.cs:
+	* System.Data.OleDb/OleDbConnection.cs: removed limitation of one
+	data adapter at a time. Mono's version can open as many as you want,
+	for free.
+
 2002-10-25  Tim Coleman ([email protected])
 	* System.Data.SqlClient/SqlConnectionPool.cs:
 		New class added

+ 0 - 7
mcs/class/System.Data/System.Data.OleDb/OleDbCommand.cs

@@ -234,8 +234,6 @@ namespace System.Data.OleDb
 			if (connection.State == ConnectionState.Closed)
 				throw new InvalidOperationException ("State == Closed");
 			// FIXME: a third check is mentioned in .NET docs
-			if (connection.DataReader != null)
-				throw new InvalidOperationException ("DataReader != null");
 
 			IntPtr gdaConnection = connection.GdaConnection;
 			IntPtr gdaParameterList = parameters.GdaParameterList;
@@ -264,8 +262,6 @@ namespace System.Data.OleDb
 
 			if (connection.State != ConnectionState.Open)
 				throw new InvalidOperationException ("State != Open");
-			if (connection.DataReader != null)
-				throw new InvalidOperationException ("DataReader != null");
 
 			this.behavior = behavior;
 
@@ -303,9 +299,6 @@ namespace System.Data.OleDb
 		
 		public object ExecuteScalar ()
 		{
-			if (connection.DataReader != null)
-				throw new InvalidOperationException ("DataReader != null");
-			
 			SetupGdaCommand ();
 			OleDbDataReader reader = ExecuteReader ();
 			if (reader == null) {

+ 1 - 16
mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs

@@ -21,7 +21,6 @@ namespace System.Data.OleDb
 
 		string connectionString;
 		int connectionTimeout;
-		OleDbDataReader dataReader;
 		IntPtr gdaConnection;
 
 		#endregion
@@ -34,7 +33,6 @@ namespace System.Data.OleDb
 			gdaConnection = IntPtr.Zero;
 			connectionTimeout = 15;
 			connectionString = null;
-			dataReader = null;
 		}
 
 		public OleDbConnection (string connectionString) : this ()
@@ -123,16 +121,6 @@ namespace System.Data.OleDb
 				return gdaConnection;
 			}
 		}
-
-		internal OleDbDataReader DataReader
-	        {
-			get {
-				return dataReader;
-			}
-			set {
-				dataReader = value;
-			}
-		}
 		
 		#endregion // Properties
 	
@@ -181,14 +169,11 @@ namespace System.Data.OleDb
 				libgda.gda_connection_close (gdaConnection);
 				gdaConnection = IntPtr.Zero;
 			}
-
-			dataReader = null;
 		}
 
 		public OleDbCommand CreateCommand ()
 		{
-			if (State == ConnectionState.Open &&
-			    DataReader == null)
+			if (State == ConnectionState.Open)
 				return new OleDbCommand (null, this);
 
 			return null;

+ 148 - 21
mcs/class/System.Data/System.Data.OleDb/OleDbDataAdapter.cs

@@ -62,27 +62,45 @@ namespace System.Data.OleDb
 		#region Properties
 
 		public OleDbCommand DeleteCommand {
-			get { return deleteCommand; }
-			set { deleteCommand = value; }
+			get {
+				return deleteCommand;
+			}
+			set {
+				deleteCommand = value;
+			}
 		}
 
 		public OleDbCommand InsertCommand {
-			get { return insertCommand; }
-			set { insertCommand = value; }
+			get {
+				return insertCommand;
+			}
+			set {
+				insertCommand = value;
+			}
 		}
 
 		public OleDbCommand SelectCommand {
-			get { return selectCommand; }
-			set { selectCommand = value; }
+			get {
+				return selectCommand;
+			}
+			set {
+				selectCommand = value;
+			}
 		}
 
 		public OleDbCommand UpdateCommand {
-			get { return updateCommand; }
-			set { updateCommand = value; }
+			get {
+				return updateCommand;
+			}
+			set {
+				updateCommand = value;
+			}
 		}
 
 		IDbCommand IDbDataAdapter.DeleteCommand {
-			get { return DeleteCommand; }
+			get {
+				return DeleteCommand;
+			}
 			set { 
 				if (!(value is OleDbCommand))
 					throw new ArgumentException ();
@@ -91,7 +109,9 @@ namespace System.Data.OleDb
 		}
 
 		IDbCommand IDbDataAdapter.InsertCommand {
-			get { return InsertCommand; }
+			get {
+				return InsertCommand;
+			}
 			set { 
 				if (!(value is OleDbCommand))
 					throw new ArgumentException ();
@@ -100,7 +120,9 @@ namespace System.Data.OleDb
 		}
 
 		IDbCommand IDbDataAdapter.SelectCommand {
-			get { return SelectCommand; }
+			get {
+				return SelectCommand;
+			}
 			set { 
 				if (!(value is OleDbCommand))
 					throw new ArgumentException ();
@@ -109,17 +131,27 @@ namespace System.Data.OleDb
 		}
 
 		MissingMappingAction IDataAdapter.MissingMappingAction {
-			get { return missingMappingAction; }
-			set { missingMappingAction = value; }
+			get {
+				return missingMappingAction;
+			}
+			set {
+				missingMappingAction = value;
+			}
 		}
 
 		MissingSchemaAction IDataAdapter.MissingSchemaAction {
-			get { return missingSchemaAction; }
-			set { missingSchemaAction = value; }
+			get {
+				return missingSchemaAction;
+			}
+			set {
+				missingSchemaAction = value;
+			}
 		}
 		
 		IDbCommand IDbDataAdapter.UpdateCommand {
-			get { return UpdateCommand; }
+			get {
+				return UpdateCommand;
+			}
 			set { 
 				if (!(value is OleDbCommand))
 					throw new ArgumentException ();
@@ -128,23 +160,107 @@ namespace System.Data.OleDb
 		}
 
 		ITableMappingCollection IDataAdapter.TableMappings {
-			get { return TableMappings; }
+			get {
+				return TableMappings;
+			}
 		}
 
 		#endregion // Properties
 
 		#region Methods
 
-		protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+		public int Fill (DataTable dataTable, object ADODBRecordSet)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public int Fill (DataSet dataSet, object ADODBRecordSet, string srcTable)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public override int Fill (DataSet dataSet)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override int Fill (DataTable dataTable, IDataReader dataReader)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override int Fill (DataTable dataTable,
+					     IDbCommand command,
+					     CommandBehavior behavior)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override int Fill (DataSet dataSet,
+					     string srcTable,
+					     IDataReader dataReader,
+					     int startRecord,
+					     int maxRecords)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override int Fill (DataSet dataSet,
+					     int startRecord,
+					     int maxRecords,
+					     string srcTable,
+					     IDbCommand command,
+					     CommandBehavior behavior)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public override DataTable[] FillSchema (DataSet dataSet,
+							SchemaType schemaType)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override DataTable FillSchema (DataTable dataTable,
+							 SchemaType schemaType,
+							 IDbCommand command,
+							 CommandBehavior behavior)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override DataTable[] FillSchema (DataSet dataSet,
+							   SchemaType schemaType,
+							   IDbCommand command,
+							   string srcTable,
+							   CommandBehavior behavior)
 		{
-			return new OleDbRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+			throw new NotImplementedException ();
+		}
+		
+		protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow,
+									      IDbCommand command,
+									      StatementType statementType,
+									      DataTableMapping tableMapping)
+		{
+			return new OleDbRowUpdatedEventArgs (dataRow, command,
+							     statementType, tableMapping);
 		}
 
-		protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+		protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow,
+										IDbCommand command,
+										StatementType statementType,
+										DataTableMapping tableMapping)
 		{
-			return new OleDbRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+			return new OleDbRowUpdatingEventArgs (dataRow, command,
+							      statementType, tableMapping);
 		}
 
+		public override IDataParameter[] GetFillParameters ()
+		{
+			throw new NotImplementedException ();
+		}
+		
 		protected override void OnRowUpdated (RowUpdatedEventArgs value)
 		{
 			OleDbRowUpdatedEventHandler handler = (OleDbRowUpdatedEventHandler) Events[EventRowUpdated];
@@ -159,6 +275,17 @@ namespace System.Data.OleDb
 				handler (this, (OleDbRowUpdatingEventArgs) value);
 		}
 
+		public override int Update (DataSet dataSet)
+		{
+			throw new NotImplementedException ();
+		}
+
+		protected override int Update (DataRow[] dataRows,
+					       DataTableMapping tableMapping)
+		{
+			throw new NotImplementedException ();
+		}
+
 		#endregion // Methods
 
 		#region Events and Delegates

+ 0 - 3
mcs/class/System.Data/System.Data.OleDb/OleDbDataReader.cs

@@ -34,7 +34,6 @@ namespace System.Data.OleDb
 		internal OleDbDataReader (OleDbCommand command, ArrayList results) 
 		{
 			this.command = command;
-			this.command.Connection.DataReader = this;
 			open = true;
 			if (results != null)
 				gdaResults = results;
@@ -132,8 +131,6 @@ namespace System.Data.OleDb
 			open = false;
 			currentResult = -1;
 			currentRow = -1;
-
-			this.command.Connection.DataReader = null;
 		}
 
 		~OleDbDataReader ()