2002-11-30 Daniel Morgan <danmorg@sc.rr.com>
authorDaniel Morgan <monodanmorg@yahoo.com>
Sat, 30 Nov 2002 11:06:15 +0000 (11:06 -0000)
committerDaniel Morgan <monodanmorg@yahoo.com>
Sat, 30 Nov 2002 11:06:15 +0000 (11:06 -0000)
* System.Data.Odbc/OdbcDataReader.cs: implemented GetValues() method
needed by OdbcDataAdapter

* System.Data.Odbc/OdbcDataAdapter.cs
* System.Data.Odbc/OdbcRowUpdatedEventArgs.cs
* System.Data.Odbc/OdbcRowUpdatedEventHandler.cs
* System.Data.Odbc/OdbcRowUpdatingEventArgs.cs
* System.Data.Odbc/OdbcRowUpdatingEventHandler.cs: added files for an
ODBC Data Adapter

* list: added new files to linux build
in namespace System.Data.Odbc for the ODBC Data Adapter

* System.Xml/XmlDataDocument.cs: commented method
protected internal override XPathNavigator CreateNavigator(XmlNode node)
because it would not compile on .NET Framework.  Added
a FIXME comment there

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

mcs/class/System.Data/ChangeLog
mcs/class/System.Data/System.Data.Odbc/OdbcDataAdapter.cs [new file with mode: 0755]
mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs
mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventArgs.cs [new file with mode: 0755]
mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventHandler.cs [new file with mode: 0755]
mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventArgs.cs [new file with mode: 0755]
mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventHandler.cs [new file with mode: 0755]
mcs/class/System.Data/System.Xml/XmlDataDocument.cs
mcs/class/System.Data/list

index 859b64d040c9d7ae6b880d39ad2d939228db0389..7fdb2ac5689a1c5133087b2303ab9bf3648b70c8 100644 (file)
@@ -1,3 +1,23 @@
+2002-11-30  Daniel Morgan <danmorg@sc.rr.com>
+
+       * System.Data.Odbc/OdbcDataReader.cs: implemented GetValues() method
+       needed by OdbcDataAdapter
+       
+       * System.Data.Odbc/OdbcDataAdapter.cs\r
+       * System.Data.Odbc/OdbcRowUpdatedEventArgs.cs\r
+       * System.Data.Odbc/OdbcRowUpdatedEventHandler.cs\r
+       * System.Data.Odbc/OdbcRowUpdatingEventArgs.cs\r
+       * System.Data.Odbc/OdbcRowUpdatingEventHandler.cs: added files for an
+       ODBC Data Adapter
+
+       * list: added new files to linux build 
+       in namespace System.Data.Odbc for the ODBC Data Adapter
+       
+       * System.Xml/XmlDataDocument.cs: commented method
+       protected internal override XPathNavigator CreateNavigator(XmlNode node)
+       because it would not compile on .NET Framework.  Added 
+       a FIXME comment there
+
 2002-11-29  Ville Palo <vi64pa@koti.soon.fi>
 
        * System.Xml/XmlDataDocument.cs: Started to implement.
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcDataAdapter.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcDataAdapter.cs
new file mode 100755 (executable)
index 0000000..fd4c4c5
--- /dev/null
@@ -0,0 +1,187 @@
+//
+// System.Data.Odbc.OdbcDataAdapter.cs
+//
+// Author:
+//   Rodrigo Moya (rodrigo@ximian.com)
+//   Daniel Morgan (danmorg@sc.rr.com)
+//   Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) 2002 Tim Coleman
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc {
+       [DefaultEvent ("RowUpdated")]
+       public sealed class OdbcDataAdapter : DbDataAdapter, IDbDataAdapter 
+       {
+               #region Fields
+
+               bool disposed = false;  
+               OdbcCommand deleteCommand;
+               OdbcCommand insertCommand;
+               OdbcCommand selectCommand;
+               OdbcCommand updateCommand;
+
+               #endregion
+
+               #region Constructors
+               
+               public OdbcDataAdapter ()       
+                       : this (new OdbcCommand ())
+               {
+               }
+
+               public OdbcDataAdapter (OdbcCommand selectCommand) 
+               {
+                       DeleteCommand = null;
+                       InsertCommand = null;
+                       SelectCommand = selectCommand;
+                       UpdateCommand = null;
+               }
+
+               public OdbcDataAdapter (string selectCommandText, OdbcConnection selectConnection) 
+                       : this (new OdbcCommand (selectCommandText, selectConnection))
+               { 
+               }
+
+               public OdbcDataAdapter (string selectCommandText, string selectConnectionString)
+                       : this (selectCommandText, new OdbcConnection (selectConnectionString))
+               {
+               }
+
+               #endregion
+
+               #region Properties
+
+               [DataCategory ("Update")]
+               [DataSysDescription ("Used during Update for deleted rows in DataSet.")]
+               [DefaultValue (null)]
+               public OdbcCommand DeleteCommand {
+                       get { return deleteCommand; }
+                       set { deleteCommand = value; }
+               }
+
+               [DataCategory ("Update")]
+               [DataSysDescription ("Used during Update for new rows in DataSet.")]
+               [DefaultValue (null)]
+               public OdbcCommand InsertCommand {
+                       get { return insertCommand; }
+                       set { insertCommand = value; }
+               }
+
+               [DataCategory ("Fill")]
+               [DataSysDescription ("Used during Fill/FillSchema.")]
+               [DefaultValue (null)]
+               public OdbcCommand SelectCommand {
+                       get { return selectCommand; }
+                       set { selectCommand = value; }
+               }
+
+               [DataCategory ("Update")]
+               [DataSysDescription ("Used during Update for modified rows in DataSet.")]
+               [DefaultValue (null)]
+               public OdbcCommand UpdateCommand {
+                       get { return updateCommand; }
+                       set { updateCommand = value; }
+               }
+
+               IDbCommand IDbDataAdapter.DeleteCommand {
+                       get { return DeleteCommand; }
+                       set { 
+                               if (!(value is OdbcCommand)) 
+                                       throw new ArgumentException ();
+                               DeleteCommand = (OdbcCommand)value;
+                       }
+               }
+
+               IDbCommand IDbDataAdapter.InsertCommand {
+                       get { return InsertCommand; }
+                       set { 
+                               if (!(value is OdbcCommand)) 
+                                       throw new ArgumentException ();
+                               InsertCommand = (OdbcCommand)value;
+                       }
+               }
+
+               IDbCommand IDbDataAdapter.SelectCommand {
+                       get { return SelectCommand; }
+                       set { 
+                               if (!(value is OdbcCommand)) 
+                                       throw new ArgumentException ();
+                               SelectCommand = (OdbcCommand)value;
+                       }
+               }
+
+               IDbCommand IDbDataAdapter.UpdateCommand {
+                       get { return UpdateCommand; }
+                       set { 
+                               if (!(value is OdbcCommand)) 
+                                       throw new ArgumentException ();
+                               UpdateCommand = (OdbcCommand)value;
+                       }
+               }
+
+
+               ITableMappingCollection IDataAdapter.TableMappings {
+                       get { return TableMappings; }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) 
+               {
+                       return new OdbcRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+               }
+
+
+               protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) 
+               {
+                       return new OdbcRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+               }
+
+               protected override void Dispose (bool disposing)
+               {
+                       if (!disposed) {
+                               if (disposing) {
+                                       // Release managed resources
+                               }
+                               // Release unmanaged resources
+                               disposed = true;
+                       }
+               }
+
+               protected override void OnRowUpdated (RowUpdatedEventArgs value) 
+               {
+                       if (RowUpdated != null)
+                               RowUpdated (this, (OdbcRowUpdatedEventArgs) value);
+               }
+
+               protected override void OnRowUpdating (RowUpdatingEventArgs value) 
+               {
+                       if (RowUpdating != null)
+                               RowUpdating (this, (OdbcRowUpdatingEventArgs) value);
+               }
+
+               #endregion // Methods
+
+               #region Events and Delegates
+
+               [DataCategory ("Update")]
+               [DataSysDescription ("Event triggered before every DataRow during Update.")]
+               public event OdbcRowUpdatedEventHandler RowUpdated;
+
+               [DataCategory ("Update")]
+               [DataSysDescription ("Event triggered after every DataRow during Update.")]
+               public event OdbcRowUpdatingEventHandler RowUpdating;
+
+               #endregion // Events and Delegates
+
+       }
+}
index fd3484a6ade4a2739698907a69d08b97a8324512..8e812213721761fd8d8228e7607f2d9dd3dc0ff3 100644 (file)
@@ -3,8 +3,10 @@
 //
 // Author:
 //   Brian Ritchie (brianlritchie@hotmail.com) 
+//   Daniel Morgan <danmorg@sc.rr.com>
 //
 // Copyright (C) Brian Ritchie, 2002
+// Copyright (C) Daniel Morgan, 2002
 //
 
 using System.Collections;
@@ -55,8 +57,7 @@ namespace System.Data.Odbc
 
                public int FieldCount {
                        get {
-
-                       return cols.Length;
+                               return cols.Length;
                        }
                }
 
@@ -459,11 +460,30 @@ namespace System.Data.Odbc
                        }
                        return col.Value;
                }
-
-               [MonoTODO]
+               
                public int GetValues (object[] values)
                {
-                       throw new NotImplementedException ();
+                       int numValues = 0;
+
+                       // copy values
+                       for (int i = 0; i < values.Length; i++) {
+                               if (i < FieldCount) {
+                                       values[i] = GetValue(i);
+                               }
+                               else {
+                                       values[i] = null;
+                               }
+                       }
+
+                       // get number of object instances in array
+                       if (values.Length < FieldCount)
+                               numValues = values.Length;
+                       else if (values.Length == FieldCount)
+                               numValues = FieldCount;
+                       else
+                               numValues = FieldCount;
+
+                       return numValues;
                }
 
                [MonoTODO]
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventArgs.cs
new file mode 100755 (executable)
index 0000000..bf4cc56
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// System.Data.Odbc.OdbcRowUpdatedEventArgs.cs
+//
+// Author:
+//   Rodrigo Moya (rodrigo@ximian.com)
+//   Daniel Morgan (danmorg@sc.rr.com)
+//   Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc {
+       public sealed class OdbcRowUpdatedEventArgs : RowUpdatedEventArgs 
+       {
+               #region Constructors
+
+               public OdbcRowUpdatedEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) 
+                       : base (row, command, statementType, tableMapping)
+               {
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public new OdbcCommand Command {
+                       get { return (OdbcCommand) base.Command; }
+               }
+
+               #endregion // Properties
+       }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventHandler.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatedEventHandler.cs
new file mode 100755 (executable)
index 0000000..c49aefb
--- /dev/null
@@ -0,0 +1,15 @@
+//
+// System.Data.Odbc.OdbcRowUpdatedEventHandler.cs
+//
+// Author:
+//   Rodrigo Moya (rodrigo@ximian.com)
+//   Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+
+namespace System.Data.Odbc {
+       public delegate void OdbcRowUpdatedEventHandler (object sender, OdbcRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventArgs.cs
new file mode 100755 (executable)
index 0000000..4333b43
--- /dev/null
@@ -0,0 +1,38 @@
+//
+// System.Data.Odbc.OdbcRowUpdatingEventArgs.cs
+//
+// Author:
+//   Rodrigo Moya (rodrigo@ximian.com)
+//   Daniel Morgan (danmorg@sc.rr.com)
+//   Tim Coleman (tim@timcoleman.com)
+//
+// (C) Ximian, Inc 2002
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Odbc {
+       public sealed class OdbcRowUpdatingEventArgs : RowUpdatingEventArgs
+       {
+               #region Constructors
+
+               public OdbcRowUpdatingEventArgs (DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping) 
+                       : base (row, command, statementType, tableMapping)
+               {
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public new OdbcCommand Command {
+                       get { return (OdbcCommand) base.Command; }
+                       set { base.Command = value; }
+               }
+
+               #endregion // Properties
+       }
+}
diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventHandler.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcRowUpdatingEventHandler.cs
new file mode 100755 (executable)
index 0000000..248b78c
--- /dev/null
@@ -0,0 +1,15 @@
+//
+// System.Data.Odbc.OdbcRowUpdatingEventHandler.cs
+//
+// Author:
+//   Rodrigo Moya (rodrigo@ximian.com)
+//   Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+
+namespace System.Data.Odbc {
+       public delegate void OdbcRowUpdatingEventHandler(object sender, OdbcRowUpdatingEventArgs e);
+}
index 8c3cc706f5d3dc824de97a191c74f82e2e9641df..07a159b91ca03e32f577687112f48e2986caa84c 100644 (file)
@@ -272,10 +272,11 @@ namespace System.Xml {
 
                #region Protected Methods
 
-               [MonoTODO]
-               protected internal override XPathNavigator CreateNavigator(XmlNode node) {
-                       throw new NotImplementedException();
-               }
+               //FIXME: how do you handle this?
+               //[MonoTODO]
+               //protected internal override XPathNavigator CreateNavigator(XmlNode node) {
+               //      throw new NotImplementedException();
+               //}
 
                [MonoTODO]
                public new XPathNavigator CreateNavigator() {
index b84bed345d18440b08de35b34ce87707156f5485..312cbdbf3d231222f03643d61c843ee96eb73f86 100755 (executable)
@@ -157,6 +157,11 @@ System.Data.Odbc/OdbcParameterCollection.cs
 System.Data.Odbc/OdbcTransaction.cs
 System.Data.Odbc/OdbcType.cs
 System.Data.Odbc/libodbc.cs
+System.Data.Odbc/OdbcDataAdapter.cs\r
+System.Data.Odbc/OdbcRowUpdatedEventArgs.cs\r
+System.Data.Odbc/OdbcRowUpdatedEventHandler.cs\r
+System.Data.Odbc/OdbcRowUpdatingEventArgs.cs\r
+System.Data.Odbc/OdbcRowUpdatingEventHandler.cs
 System.Data.SqlClient/SqlClientPermission.cs
 System.Data.SqlClient/SqlClientPermissionAttribute.cs
 System.Data.SqlClient/SqlCommand.cs