(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / IBM.Data.DB2 / IBM.Data.DB2 / DB2DataAdapter.cs
blob1521192285b55f493fe37969ba7364c1e23e163b
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 using System;
23 using System.ComponentModel;
24 using System.Data;
25 using System.Data.Common;
27 namespace IBM.Data.DB2 {
29 public sealed class DB2DataAdapter : DbDataAdapter, IDbDataAdapter
31 #region Fields
33 bool disposed = false;
34 DB2Command deleteCommand;
35 DB2Command insertCommand;
36 DB2Command selectCommand;
37 DB2Command updateCommand;
39 #endregion
41 #region Constructors
43 public DB2DataAdapter ()
44 : this (new DB2Command ())
48 public DB2DataAdapter (DB2Command selectCommand)
50 DeleteCommand = null;
51 InsertCommand = null;
52 SelectCommand = selectCommand;
53 UpdateCommand = null;
56 public DB2DataAdapter (string selectCommandText, DB2Connection selectConnection)
57 : this (new DB2Command (selectCommandText, selectConnection))
61 public DB2DataAdapter (string selectCommandText, string selectConnectionString)
62 : this (selectCommandText, new DB2Connection (selectConnectionString))
66 #endregion
68 #region Properties
71 public DB2Command DeleteCommand {
72 get { return deleteCommand; }
73 set { deleteCommand = value; }
77 public DB2Command InsertCommand {
78 get { return insertCommand; }
79 set { insertCommand = value; }
83 public DB2Command SelectCommand {
84 get { return selectCommand; }
85 set { selectCommand = value; }
89 public DB2Command UpdateCommand {
90 get { return updateCommand; }
91 set { updateCommand = value; }
94 IDbCommand IDbDataAdapter.DeleteCommand {
95 get { return DeleteCommand; }
96 set {
97 if (!(value is DB2Command))
98 throw new ArgumentException ();
99 DeleteCommand = (DB2Command)value;
103 IDbCommand IDbDataAdapter.InsertCommand {
104 get { return InsertCommand; }
105 set {
106 if (!(value is DB2Command))
107 throw new ArgumentException ();
108 InsertCommand = (DB2Command)value;
112 IDbCommand IDbDataAdapter.SelectCommand {
113 get { return SelectCommand; }
114 set {
115 if (!(value is DB2Command))
116 throw new ArgumentException ();
117 SelectCommand = (DB2Command)value;
121 IDbCommand IDbDataAdapter.UpdateCommand {
122 get { return UpdateCommand; }
123 set {
124 if (!(value is DB2Command))
125 throw new ArgumentException ();
126 UpdateCommand = (DB2Command)value;
131 ITableMappingCollection IDataAdapter.TableMappings {
132 get { return TableMappings; }
135 #endregion
137 #region Methods
139 protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
141 return new DB2RowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
145 protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
147 return new DB2RowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
150 protected override void Dispose (bool disposing)
152 if (!disposed) {
153 if (disposing) {
157 disposed = true;
161 protected override void OnRowUpdated (RowUpdatedEventArgs value)
163 if (RowUpdated != null)
164 RowUpdated (this, (DB2RowUpdatedEventArgs) value);
167 protected override void OnRowUpdating (RowUpdatingEventArgs value)
169 if (RowUpdating != null)
170 RowUpdating (this, (DB2RowUpdatingEventArgs) value);
173 #endregion
175 #region Events and Delegates
177 public event DB2RowUpdatedEventHandler RowUpdated;
179 public event DB2RowUpdatingEventHandler RowUpdating;
181 #endregion