2 // OracleDataAdapter.cs
4 // Part of the Mono class libraries at
5 // mcs/class/System.Data.OracleClient/System.Data.OracleClient
7 // Assembly: System.Data.OracleClient.dll
8 // Namespace: System.Data.OracleClient
10 // Author: Tim Coleman <tim@timcoleman.com>
12 // Parts transferred from System.Data.SqlClient/SqlDataAdapter.cs
14 // Rodrigo Moya (rodrigo@ximian.com)
15 // Daniel Morgan (danmorg@sc.rr.com)
16 // Tim Coleman (tim@timcoleman.com)
18 // Copyright (C) Tim Coleman, 2003
19 // (C) Ximian, Inc 2002
21 // Licensed under the MIT/X11 License.
25 using System
.ComponentModel
;
27 using System
.Data
.Common
;
28 using System
.Drawing
.Design
;
30 namespace System
.Data
.OracleClient
{
31 [DefaultEvent ("RowUpdated")]
32 [Designer ("Microsoft.VSDesigner.Data.VS.OracleDataAdapterDesigner, " + Consts
.AssemblyMicrosoft_VSDesigner
)]
33 [ToolboxItem ("Microsoft.VSDesigner.Data.VS.OracleDataAdapterToolboxItem, " + Consts
.AssemblyMicrosoft_VSDesigner
)]
34 public sealed class OracleDataAdapter
: DbDataAdapter
, IDbDataAdapter
38 bool disposed
= false;
39 OracleCommand deleteCommand
;
40 OracleCommand insertCommand
;
41 OracleCommand selectCommand
;
42 OracleCommand updateCommand
;
48 public OracleDataAdapter ()
49 : this (new OracleCommand ())
53 public OracleDataAdapter (OracleCommand selectCommand
)
57 SelectCommand
= selectCommand
;
61 public OracleDataAdapter (string selectCommandText
, OracleConnection selectConnection
)
62 : this (new OracleCommand (selectCommandText
, selectConnection
))
66 public OracleDataAdapter (string selectCommandText
, string selectConnectionString
)
67 : this (selectCommandText
, new OracleConnection (selectConnectionString
))
76 [Editor ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, " + Consts
.AssemblyMicrosoft_VSDesigner
, typeof(UITypeEditor
))]
77 public OracleCommand DeleteCommand
{
78 get { return deleteCommand; }
79 set { deleteCommand = value; }
83 [Editor ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, " + Consts
.AssemblyMicrosoft_VSDesigner
, typeof(UITypeEditor
))]
84 public OracleCommand InsertCommand
{
85 get { return insertCommand; }
86 set { insertCommand = value; }
90 [Editor ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, " + Consts
.AssemblyMicrosoft_VSDesigner
, typeof(UITypeEditor
))]
91 public OracleCommand SelectCommand
{
92 get { return selectCommand; }
93 set { selectCommand = value; }
97 [Editor ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, " + Consts
.AssemblyMicrosoft_VSDesigner
, typeof(UITypeEditor
))]
98 public OracleCommand UpdateCommand
{
99 get { return updateCommand; }
100 set { updateCommand = value; }
103 IDbCommand IDbDataAdapter
.DeleteCommand
{
104 get { return DeleteCommand; }
106 if (!(value is OracleCommand
))
107 throw new ArgumentException ();
108 DeleteCommand
= (OracleCommand
) value;
112 IDbCommand IDbDataAdapter
.InsertCommand
{
113 get { return InsertCommand; }
115 if (!(value is OracleCommand
))
116 throw new ArgumentException ();
117 InsertCommand
= (OracleCommand
) value;
121 IDbCommand IDbDataAdapter
.SelectCommand
{
122 get { return SelectCommand; }
124 if (!(value is OracleCommand
))
125 throw new ArgumentException ();
126 SelectCommand
= (OracleCommand
) value;
130 IDbCommand IDbDataAdapter
.UpdateCommand
{
131 get { return UpdateCommand; }
133 if (!(value is OracleCommand
))
134 throw new ArgumentException ();
135 UpdateCommand
= (OracleCommand
) value;
140 ITableMappingCollection IDataAdapter
.TableMappings
{
141 get { return TableMappings; }
144 #endregion // Properties
148 protected override RowUpdatedEventArgs
CreateRowUpdatedEvent (DataRow dataRow
, IDbCommand command
, StatementType statementType
, DataTableMapping tableMapping
)
150 return new OracleRowUpdatedEventArgs (dataRow
, command
, statementType
, tableMapping
);
154 protected override RowUpdatingEventArgs
CreateRowUpdatingEvent (DataRow dataRow
, IDbCommand command
, StatementType statementType
, DataTableMapping tableMapping
)
156 return new OracleRowUpdatingEventArgs (dataRow
, command
, statementType
, tableMapping
);
159 protected override void OnRowUpdated (RowUpdatedEventArgs
value)
161 if (RowUpdated
!= null)
162 RowUpdated (this, (OracleRowUpdatedEventArgs
) value);
165 protected override void OnRowUpdating (RowUpdatingEventArgs
value)
167 if (RowUpdating
!= null)
168 RowUpdating (this, (OracleRowUpdatingEventArgs
) value);
171 #endregion // Methods
173 #region Events and Delegates
175 public event OracleRowUpdatedEventHandler RowUpdated
;
176 public event OracleRowUpdatingEventHandler RowUpdating
;
178 #endregion // Events and Delegates