2 // Mono.Data.SybaseClient.SybaseError.cs
5 // Tim Coleman (tim@timcoleman.com)
7 // Copyright (C) Tim Coleman, 2002
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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.
33 using System.Runtime.InteropServices;
35 namespace Mono.Data.SybaseClient {
37 public sealed class SybaseError
45 string procedure = "";
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;
61 this.procedure = procedure;
67 #endregion // Constructors
73 get { return theClass; }
77 public int LineNumber {
78 get { return lineNumber; }
82 public string Message {
83 get { return message; }
88 get { return number; }
92 public string Procedure {
93 get { return procedure; }
97 public string Server {
98 get { return server; }
102 public string Source {
103 get { return source; }
108 get { return state; }
111 #endregion // Properties
115 internal void SetClass (byte theClass) {
116 this.theClass = theClass;
119 internal void SetLineNumber (int lineNumber) {
120 this.lineNumber = lineNumber;
123 internal void SetMessage (string message) {
124 this.message = message;
127 internal void SetNumber (int number) {
128 this.number = number;
131 internal void SetProcedure (string procedure) {
132 this.procedure = procedure;
135 internal void SetServer (string server) {
136 this.server = server;
139 internal void SetSource (string source) {
140 this.source = source;
143 internal void SetState (byte state) {
148 public override string ToString ()
152 stackTrace = " <Stack Trace>";
153 // FIXME: generate the correct SQL error string
154 toStr = "SybaseError:" + message + stackTrace;
158 #endregion // Methods