// Copyright (C) 2002 Tim Coleman
//
+//
+// Copyright (C) 2004 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.
+//
+
using System;
using System.ComponentModel;
using System.Data;
[DefaultEvent ("RowUpdated")]
[DesignerAttribute ("Microsoft.VSDesigner.Data.VS.OdbcDataAdapterDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")]
[ToolboxItemAttribute ("Microsoft.VSDesigner.Data.VS.OdbcDataAdapterToolboxItem, "+ Consts.AssemblyMicrosoft_VSDesigner)]
- public sealed class OdbcDataAdapter : DbDataAdapter, IDbDataAdapter
+ public sealed class OdbcDataAdapter : DbDataAdapter, IDbDataAdapter, ICloneable
{
#region Fields
- bool disposed = false;
+#if ONLY_1_1
+ bool disposed;
+#endif
OdbcCommand deleteCommand;
OdbcCommand insertCommand;
OdbcCommand selectCommand;
#region Constructors
- public OdbcDataAdapter ()
- : this (new OdbcCommand ())
+ public OdbcDataAdapter () : this ((OdbcCommand) null)
{
}
public OdbcDataAdapter (OdbcCommand selectCommand)
{
- DeleteCommand = null;
- InsertCommand = null;
SelectCommand = selectCommand;
- UpdateCommand = null;
}
public OdbcDataAdapter (string selectCommandText, OdbcConnection selectConnection)
[OdbcDescription ("Used during Update for deleted rows in DataSet.")]
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
- public OdbcCommand DeleteCommand {
+ public new OdbcCommand DeleteCommand {
get { return deleteCommand; }
set { deleteCommand = value; }
}
[OdbcDescription ("Used during Update for new rows in DataSet.")]
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
- public OdbcCommand InsertCommand {
+ public new OdbcCommand InsertCommand {
get { return insertCommand; }
set { insertCommand = value; }
}
[OdbcDescription ("Used during Fill/FillSchema.")]
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
- public OdbcCommand SelectCommand {
+ public new OdbcCommand SelectCommand {
get { return selectCommand; }
set { selectCommand = value; }
}
[OdbcDescription ("Used during Update for modified rows in DataSet.")]
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
- public OdbcCommand UpdateCommand {
+ public new 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;
- }
+ set { DeleteCommand = (OdbcCommand) value; }
}
IDbCommand IDbDataAdapter.InsertCommand {
get { return InsertCommand; }
- set {
- if (!(value is OdbcCommand))
- throw new ArgumentException ();
- InsertCommand = (OdbcCommand)value;
- }
+ set { InsertCommand = (OdbcCommand) value; }
}
IDbCommand IDbDataAdapter.SelectCommand {
get { return SelectCommand; }
- set {
- if (!(value is OdbcCommand))
- throw new ArgumentException ();
- SelectCommand = (OdbcCommand)value;
- }
+ set { SelectCommand = (OdbcCommand) value; }
}
IDbCommand IDbDataAdapter.UpdateCommand {
get { return UpdateCommand; }
- set {
- if (!(value is OdbcCommand))
- throw new ArgumentException ();
- UpdateCommand = (OdbcCommand)value;
- }
+ set { UpdateCommand = (OdbcCommand) value; }
}
return new OdbcRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
}
+#if ONLY_1_1
protected override void Dispose (bool disposing)
{
if (!disposed) {
// Release unmanaged resources
disposed = true;
}
+ base.Dispose (true);
}
+#endif
protected override void OnRowUpdated (RowUpdatedEventArgs value)
{
RowUpdating (this, (OdbcRowUpdatingEventArgs) value);
}
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
#endregion // Methods
#region Events and Delegates