Merge branch 'master' of github.com:tgiphil/mono
[mono.git] / mcs / class / System.Data.OracleClient / System.Data.OracleClient.jvm / OracleException.cs
1 //\r
2 // System.Data.SqlClient.SqlException\r
3 //
4 // Authors:
5 //      Konstantin Triger <kostat@mainsoft.com>
6 //      Boris Kirzner <borisk@mainsoft.com>
7 //      
8 // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
9 //
10
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //\r
31 \r
32 namespace System.Data.OracleClient {\r
33 \r
34         using java.sql;\r
35 \r
36         using System;\r
37         using System.Data.ProviderBase;\r
38 \r
39         /**\r
40          * The exception that is thrown when SQL Server returns a warning or error.\r
41          * This class cannot be inherited.\r
42          */\r
43 \r
44         /*\r
45         * CURRENT LIMITATIONS\r
46         * 1. Constructor for serialization SqlException(SerializationInfo info, StreamingContext sc) \r
47         *    is not supported.\r
48         * 2. Method "void GetObjectData(...,...)" is not supported (serialization)\r
49         */\r
50 \r
51         public sealed class OracleException : AbstractDbException {\r
52                 internal OracleException(Exception cause, OracleConnection connection) : base(cause, connection) {}\r
53 \r
54                 internal OracleException(SQLException cause, OracleConnection connection) : base(cause, connection) {}\r
55 \r
56                 internal OracleException(string message, SQLException cause, OracleConnection connection) : base(message, cause, connection) {}\r
57 \r
58                 protected override AbstractDbErrorCollection DbErrors {\r
59                         get {\r
60                                 return Errors;\r
61                         }\r
62                 }\r
63 \r
64         \r
65 \r
66                 /**\r
67                  * Gets the severity level of the error returned from the SQL Server .NET \r
68                  * Data Provider.\r
69                  * @return severity level of the first error in the collection.\r
70                  */\r
71 //              public byte Class {\r
72 //                      get {\r
73 //                              SqlErrorCollection errors = Errors;\r
74 //                              return errors.Count > 0 ? errors[0].Class : (byte)0;\r
75 //                      }\r
76 //              }\r
77 \r
78                 /**\r
79                  * Gets a collection of one or more SqlError objects that give detailed \r
80                  * information about exceptions generated by the SQL Server .NET Data Provider.\r
81                  * @return collection of SqlError objects\r
82                  */\r
83                 internal OracleErrorCollection Errors {\r
84                         get {\r
85                                 return new OracleErrorCollection(_cause, _connection);\r
86                         }\r
87                 }\r
88 \r
89                 public int Code {\r
90                         get { return DbErrorCode; }\r
91                 }\r
92 \r
93                 /**\r
94                  * Gets the line number within the Transact-SQL command batch or stored \r
95                  * procedure that generated the error.\r
96                  * @return line number of the first error in the collection.\r
97                  */\r
98 //              public int LineNumber {\r
99 //                      get {\r
100 //                              SqlErrorCollection errors = Errors;\r
101 //                              return errors.Count > 0 ? errors[0].LineNumber : 0;\r
102 //                      }\r
103 //              }\r
104 \r
105                 /**\r
106                  * Gets a number that identifies the type of error.\r
107                  * @return number that identifies the type of first error in the collection\r
108                  */\r
109 //              public int Number {\r
110 //                      get {\r
111 //                              SqlErrorCollection errors = Errors;\r
112 //                              return errors.Count > 0 ? errors[0].Number : 0;\r
113 //                      }\r
114 //              }\r
115 \r
116                 /**\r
117                  * Gets the name of the stored procedure or remote procedure call (RPC) \r
118                  * that generated the error.\r
119                  * @return name of the stored procedure \r
120                  */\r
121 //              public String Procedure {\r
122 //                      get {\r
123 //                              SqlErrorCollection errors = Errors;\r
124 //                              return errors.Count > 0 ? errors[0].Procedure : null;\r
125 //                      }\r
126 //              }\r
127 \r
128                 /**\r
129                  * Gets the name of the computer running an instance of SQL Server \r
130                  * that generated the error.\r
131                  * @return name of the computer where error generated\r
132                  */\r
133 //              public String Server {\r
134 //                      get {\r
135 //                              SqlErrorCollection errors = Errors;\r
136 //                              return errors.Count > 0 ? errors[0].Server : null;\r
137 //                      }\r
138 //              }\r
139 \r
140 \r
141                 /**\r
142                  * Gets a numeric error code from SQL Server that represents an error, \r
143                  * warning or "no data found" message. \r
144                  * @return numeric error code from SQL Server\r
145                  */\r
146 //              public byte State {\r
147 //                      get {\r
148 //                              SqlErrorCollection errors = Errors;\r
149 //                              return errors.Count > 0 ? errors[0].State : (byte)0;\r
150 //                      }\r
151 //              }\r
152         }\r
153 }