Added files and folders for TARGET_JVM code base
[mono.git] / mcs / class / System.Data / System.Data.SqlClient.jvm / SqlError.cs
1 /* 
2  * @(#)SqlError.java    1.0 01/01/03
3  *
4  * Copyright 2002 Mainsoft Corporation. All Rights Reserved.
5  *
6  * This software is the proprietary information of Mainsoft Corporation.
7  * Use is subject to license terms.
8  *
9  */
10
11 namespace System.Data.SqlClient
12 {
13         using System.Data.ProviderBase;
14         using java.sql;
15         using System.Data.Common;
16
17     /**
18      * Collects information relevant to a warning or error returned by SQL Server.
19      *
20      * @author  Pavel Sandler
21      * @version 1.0, 01/01/03
22      */
23
24         [Serializable]
25     public class SqlError : AbstractDbError
26     {
27                 string _serverVersion;
28         /**
29          * Initialize SqlError object
30          * */
31         internal SqlError(SQLException e, AbstractDBConnection connection) : base(e, connection)
32         {
33                         if (connection != null)
34                                 _serverVersion = connection.ServerVersion;
35         }
36
37         /**
38          * Overridden. Gets the complete text of the error message.
39          *
40          * @return A string representation of the current object.
41          */
42         public override String ToString()
43         {
44             return String.Concat("SqlError:", Message, _e.StackTrace);
45         }
46
47         /**
48          * Gets the name of the provider that generated the error.
49          *
50          * @return The name of the provider
51          */
52         public String Source
53         {
54             get
55             {
56                 return DbSource;
57             }
58         }
59
60         /**
61          * Gets a number that identifies the type of error.
62          *
63          * @return Number of the error
64          */
65         public int Number
66         {
67             get
68             {
69                 return DbErrorCode;
70             }
71         }
72
73         /**
74          * Gets a numeric error code from SQL Server that represents an error,
75          * warning or "no data found" message. For more information on how to
76          * decode these values, see SQL Server Books Online.
77          *
78          * @return Error Code
79          */
80         public byte State
81         {
82             get
83             {
84                 return 0; // & BitConstants.ALL_BYTE;
85             }
86         }
87
88         /**
89          * Gets the severity level of the error returned from SQL Server.
90          *
91          * @return Severity level of the error
92          */
93         public byte Class
94         {
95             get
96             {
97                 return 0; // & BitConstants.ALL_BYTE;
98             }
99         }
100
101         /**
102          * Gets the name of the instance of SQL Server that generated the error.
103          *
104          * @return The name of the server
105          */
106         public String Server
107         {
108             get
109             {
110                 return _serverVersion;
111             }
112         }
113
114         /**
115          * Gets the text describing the error.
116          *
117          * @return The text describing the error
118          */
119         public String Message
120         {
121             get
122             {
123                 return DbMessage;
124             }
125         }
126
127         /**
128          * Gets the name of the stored procedure or remote procedure call (RPC)
129          * that generated the error.
130          *
131          * @return The name of stored procedure that generated the error.
132          */
133         public String Procedure
134         {
135             get
136             {
137                 return null;
138             }
139         }
140
141         /**
142          * Bets the line number within the Transact-SQL command batch or stored
143          * procedure that contains the error.
144          *
145          * @return Line number of error in stored procedure
146          */
147         public int LineNumber
148         {
149             get
150             {
151                 return 0;
152             }
153         }
154     }
155 }