From 5ae39b17468e4392f9f5db32e768bfb3f4700dfe Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Mon, 28 Oct 2002 10:59:37 +0000 Subject: [PATCH] 2002-10-27 Rodrigo Moya * 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 --- mcs/class/System.Data/ChangeLog | 11 ++ .../System.Data.OleDb/OleDbCommand.cs | 7 - .../System.Data.OleDb/OleDbConnection.cs | 17 +- .../System.Data.OleDb/OleDbDataAdapter.cs | 169 +++++++++++++++--- .../System.Data.OleDb/OleDbDataReader.cs | 3 - 5 files changed, 160 insertions(+), 47 deletions(-) diff --git a/mcs/class/System.Data/ChangeLog b/mcs/class/System.Data/ChangeLog index 13000e68e88..6e7b38083e2 100644 --- a/mcs/class/System.Data/ChangeLog +++ b/mcs/class/System.Data/ChangeLog @@ -1,3 +1,14 @@ +2002-10-27 Rodrigo Moya + + * 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 (tim@timcoleman.com) * System.Data.SqlClient/SqlConnectionPool.cs: New class added diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbCommand.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbCommand.cs index e0c8189e299..8de3e49794c 100644 --- a/mcs/class/System.Data/System.Data.OleDb/OleDbCommand.cs +++ b/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) { diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs index f88f5988af5..8251b1d417b 100644 --- a/mcs/class/System.Data/System.Data.OleDb/OleDbConnection.cs +++ b/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; diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbDataAdapter.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbDataAdapter.cs index d148b2c8329..dfd3057c5bc 100644 --- a/mcs/class/System.Data/System.Data.OleDb/OleDbDataAdapter.cs +++ b/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 diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbDataReader.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbDataReader.cs index 7e6a5e096d1..e7376875cb4 100644 --- a/mcs/class/System.Data/System.Data.OleDb/OleDbDataReader.cs +++ b/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 () -- 2.25.1