New test.
[mono.git] / mcs / class / Mono.Data.SybaseClient / Mono.Data.SybaseClient / SybaseError.cs
1 //
2 // Mono.Data.SybaseClient.SybaseError.cs
3 //
4 // Author:
5 //   Tim Coleman (tim@timcoleman.com)
6 //
7 // Copyright (C) Tim Coleman, 2002
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System;
32 using System.Data;
33 using System.Runtime.InteropServices;
34
35 namespace Mono.Data.SybaseClient {
36         [MonoTODO]
37         public sealed class SybaseError
38         {
39                 #region Fields
40
41                 byte theClass = 0;
42                 int lineNumber = 0;
43                 string message = "";
44                 int number = 0;
45                 string procedure = "";
46                 string server = "";
47                 string source = "";
48                 byte state = 0;
49
50                 #endregion // Fields
51
52                 #region Constructors
53
54                 internal SybaseError(byte theClass, int lineNumber,
55                         string message, int number, string procedure,
56                         string server, string source, byte state) {
57                         this.theClass = theClass;
58                         this.lineNumber = lineNumber;
59                         this.message = message;
60                         this.number = number;
61                         this.procedure = procedure;
62                         this.server = server;
63                         this.source = source;
64                         this.state = state;
65                 }
66
67                 #endregion // Constructors
68                 
69                 #region Properties
70
71                 [MonoTODO]
72                 public byte Class {
73                         get { return theClass; }
74                 }
75
76                 [MonoTODO]
77                 public int LineNumber {
78                         get { return lineNumber; }
79                 }
80
81                 [MonoTODO]
82                 public string Message {
83                         get { return message; }
84                 }
85                 
86                 [MonoTODO]
87                 public int Number {
88                         get { return number; }
89                 }
90
91                 [MonoTODO]
92                 public string Procedure {
93                         get { return procedure; }
94                 }
95
96                 [MonoTODO]
97                 public string Server {
98                         get { return server; }
99                 }
100
101                 [MonoTODO]
102                 public string Source {
103                         get { return source; }
104                 }
105
106                 [MonoTODO]
107                 public byte State {
108                         get { return state; }
109                 }
110
111                 #endregion // Properties
112
113                 #region Methods
114
115                 internal void SetClass (byte theClass) {
116                         this.theClass = theClass;
117                 }
118
119                 internal void SetLineNumber (int lineNumber) {
120                         this.lineNumber = lineNumber;
121                 }
122
123                 internal void SetMessage (string message) {
124                         this.message = message;
125                 }
126
127                 internal void SetNumber (int number) {
128                         this.number = number;
129                 }
130
131                 internal void SetProcedure (string procedure) {
132                         this.procedure = procedure;
133                 }
134
135                 internal void SetServer (string server) {
136                         this.server = server;
137                 }
138
139                 internal void SetSource (string source) {
140                         this.source = source;
141                 }
142
143                 internal void SetState (byte state) {
144                         this.state = state;
145                 }
146
147                 [MonoTODO]
148                 public override string ToString ()
149                 {
150                         String toStr;
151                         String stackTrace;
152                         stackTrace = " <Stack Trace>";
153                         // FIXME: generate the correct SQL error string
154                         toStr = "SybaseError:" + message + stackTrace;
155                         return toStr;
156                 }
157
158                 #endregion // Methods
159         }
160 }