2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / FirebirdSql.Data.Firebird / FirebirdSql.Data.Firebird / Isql / CommandExecutingEventArgs.cs
1 /*
2  *      Firebird ADO.NET Data provider for .NET and     Mono 
3  * 
4  *         The contents of this file are subject to     the     Initial 
5  *         Developer's Public License Version 1.0 (the "License"); 
6  *         you may not use this file except     in compliance with the 
7  *         License.     You     may     obtain a copy of the License at 
8  *         http://www.firebirdsql.org/index.php?op=doc&id=idpl
9  *
10  *         Software     distributed     under the License is distributed on     
11  *         an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
12  *         express or implied.  See     the     License for     the     specific 
13  *         language     governing rights and limitations under the License.
14  * 
15  *      Copyright (c) 2003,     2004 Abel Eduardo Pereira
16  *      All     Rights Reserved.
17  */
18
19 using System;
20 using FirebirdSql.Data.Firebird;
21
22 namespace FirebirdSql.Data.Firebird.Isql
23 {
24         #region Delegates
25
26         ///     <summary>
27         ///     The     event handler type trigged before a     SQL     statement execution.
28         ///     </summary>
29         public delegate void CommandExecutingEventHandler(object sender, CommandExecutingEventArgs e);
30
31         #endregion
32
33         ///     <summary>
34         ///     CommandExecutingEventArgs encapsulates the events arguments     for     the     event trigged 
35         ///     from the <see cref="FbBatchExecution"/> during the execution. 
36         ///     </summary>
37         ///     <remarks>
38         ///     
39         ///     </remarks>
40         public class CommandExecutingEventArgs: EventArgs
41         {
42                 #region Private
43
44                 private FbCommand sqlCommand;
45
46                 #endregion
47
48                 #region Properties
49
50                 ///     <summary>
51                 ///     Returns the     <see cref="FbCommand"/> instance that created for the SQL statement     that goes 
52                 ///     for     execution. 
53                 ///     </summary>
54                 public FbCommand SqlCommand     
55                 {
56                         get     { return this.sqlCommand; }
57                 }
58
59                 ///     <summary>
60                 ///     Returns the     <see cref="SqlStatementType"/> of the current <see cref="SqlCommand"/>.
61                 ///     </summary>
62                 public SqlStatementType StatementType 
63                 {
64                         get     { return FbBatchExecution.GetStatementType(this.SqlCommand.CommandText); }
65                 }
66
67                 #endregion
68
69                 #region Constructors
70
71                 ///     <summary>
72                 ///     Creates an instance     of CommandExecutingEventArgs class.
73                 ///     </summary>
74                 ///     <param name="sqlCommand">The FbCommand properly instanciated.</param>
75                 ///     <remarks>The <b>sqlCommand</b> should be proper instanciated with a     valid 
76                 ///     <see cref="FbCommand"/> and     with the SQL statement loaded in <see cref="FbCommand.CommandText"/>.
77                 ///     </remarks>
78                 public CommandExecutingEventArgs(FbCommand sqlCommand)
79                 {
80                         this.sqlCommand = sqlCommand;
81                 }
82
83                 #endregion
84
85                 #region Methods
86
87                 ///     <summary>
88                 ///     Overrided. Returns the SQL statement that goes for execution.
89                 ///     </summary>
90                 ///     <returns>The SQL statement that will be executed.</returns>
91                 public override string ToString() 
92                 {
93                         return this.sqlCommand.CommandText;
94                 }
95
96                 #endregion
97         }
98 }