OracleException.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. //
  2. // System.Data.SqlClient.SqlException
  3. //
  4. // Authors:
  5. // Konstantin Triger <[email protected]>
  6. // Boris Kirzner <[email protected]>
  7. //
  8. // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
  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. namespace System.Data.OracleClient {
  31. using java.sql;
  32. using System;
  33. using System.Data.ProviderBase;
  34. /**
  35. * The exception that is thrown when SQL Server returns a warning or error.
  36. * This class cannot be inherited.
  37. */
  38. /*
  39. * CURRENT LIMITATIONS
  40. * 1. Constructor for serialization SqlException(SerializationInfo info, StreamingContext sc)
  41. * is not supported.
  42. * 2. Method "void GetObjectData(...,...)" is not supported (serialization)
  43. */
  44. public sealed class OracleException : AbstractDbException {
  45. internal OracleException(Exception cause, OracleConnection connection) : base(cause, connection) {}
  46. internal OracleException(SQLException cause, OracleConnection connection) : base(cause, connection) {}
  47. internal OracleException(string message, SQLException cause, OracleConnection connection) : base(message, cause, connection) {}
  48. protected override AbstractDbErrorCollection DbErrors {
  49. get {
  50. return Errors;
  51. }
  52. }
  53. /**
  54. * Gets the severity level of the error returned from the SQL Server .NET
  55. * Data Provider.
  56. * @return severity level of the first error in the collection.
  57. */
  58. // public byte Class {
  59. // get {
  60. // SqlErrorCollection errors = Errors;
  61. // return errors.Count > 0 ? errors[0].Class : (byte)0;
  62. // }
  63. // }
  64. /**
  65. * Gets a collection of one or more SqlError objects that give detailed
  66. * information about exceptions generated by the SQL Server .NET Data Provider.
  67. * @return collection of SqlError objects
  68. */
  69. internal OracleErrorCollection Errors {
  70. get {
  71. return new OracleErrorCollection(_cause, _connection);
  72. }
  73. }
  74. public int Code {
  75. get { return DbErrorCode; }
  76. }
  77. /**
  78. * Gets the line number within the Transact-SQL command batch or stored
  79. * procedure that generated the error.
  80. * @return line number of the first error in the collection.
  81. */
  82. // public int LineNumber {
  83. // get {
  84. // SqlErrorCollection errors = Errors;
  85. // return errors.Count > 0 ? errors[0].LineNumber : 0;
  86. // }
  87. // }
  88. /**
  89. * Gets a number that identifies the type of error.
  90. * @return number that identifies the type of first error in the collection
  91. */
  92. // public int Number {
  93. // get {
  94. // SqlErrorCollection errors = Errors;
  95. // return errors.Count > 0 ? errors[0].Number : 0;
  96. // }
  97. // }
  98. /**
  99. * Gets the name of the stored procedure or remote procedure call (RPC)
  100. * that generated the error.
  101. * @return name of the stored procedure
  102. */
  103. // public String Procedure {
  104. // get {
  105. // SqlErrorCollection errors = Errors;
  106. // return errors.Count > 0 ? errors[0].Procedure : null;
  107. // }
  108. // }
  109. /**
  110. * Gets the name of the computer running an instance of SQL Server
  111. * that generated the error.
  112. * @return name of the computer where error generated
  113. */
  114. // public String Server {
  115. // get {
  116. // SqlErrorCollection errors = Errors;
  117. // return errors.Count > 0 ? errors[0].Server : null;
  118. // }
  119. // }
  120. /**
  121. * Gets a numeric error code from SQL Server that represents an error,
  122. * warning or "no data found" message.
  123. * @return numeric error code from SQL Server
  124. */
  125. // public byte State {
  126. // get {
  127. // SqlErrorCollection errors = Errors;
  128. // return errors.Count > 0 ? errors[0].State : (byte)0;
  129. // }
  130. // }
  131. }
  132. }