mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
* System.Data.OleDb: added directory - for OleDb database provider classes * System.Data.SqlClient/SqlClientPermission.cs * System.Data.SqlClient/SqlClientPermissionAttribute.cs * System.Data.SqlClient/SqlCommandBuilder.cs * System.Data.SqlClient/SqlInfoMessageEventHandler.cs * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs * System.Data.SqlClient/SqlRowUpdatedEventHandler.cs * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs * System.Data.SqlClient/SqlRowUpdatingEventHandler.cs * Test/TestSqlException.cs * Test/TestSqlIsolationLevel.cs: added - more tests * System.Data.build: modified - added new files - excludes these too * System.Data.SqlClient/PostgresLibrary.cs - modified - comment * System.Data.SqlClient/SqlConnection.cs * System.Data.SqlClient/SqlCommand.cs * System.Data.SqlClient/SqlTransaction.cs * System.Data.SqlClient/SqlException.cs * System.Data.SqlClient/SqlErrorCollection.cs * System.Data.SqlClient/SqlError.cs: modified - transaction and exception/error handling. SqlConnection(connectionString) constructor should not automatically connect. * System.Data.SqlClient/SqlDataReader.cs * System.Data.SqlClient/SqlDataAdapter.cs * System.Data.SqlClient/SqlParameter.cs * System.Data.SqlClient/SqlParameterCollection.cs: modified - added using System.ComponentModel; * Test/TestSqlInsert.cs: modified - to use transaction svn path=/trunk/mcs/; revision=3933
203 lines
3.5 KiB
C#
203 lines
3.5 KiB
C#
//
|
|
// System.Data.SqlClient.SqlException.cs
|
|
//
|
|
// Author:
|
|
// Rodrigo Moya ([email protected])
|
|
// Daniel Morgan ([email protected])
|
|
//
|
|
// (C) Ximian, Inc
|
|
//
|
|
using System;
|
|
using System.Data;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace System.Data.SqlClient
|
|
{
|
|
/// <summary>
|
|
/// Exceptions, as returned by SQL databases.
|
|
/// </summary>
|
|
public sealed class SqlException : SystemException
|
|
{
|
|
private SqlErrorCollection errors = new SqlErrorCollection();
|
|
|
|
internal SqlException() {
|
|
|
|
}
|
|
|
|
internal SqlException(byte theClass, int lineNumber,
|
|
string message, int number, string procedure,
|
|
string server, string source, byte state) {
|
|
|
|
errors = new SqlErrorCollection (theClass,
|
|
lineNumber, message,
|
|
number, procedure,
|
|
server, source, state);
|
|
}
|
|
|
|
#region Properties
|
|
|
|
[MonoTODO]
|
|
public byte Class {
|
|
get {
|
|
if(errors.Count == 0)
|
|
return 0; // FIXME: throw exception here?
|
|
else
|
|
return errors[0].Class;
|
|
}
|
|
|
|
set {
|
|
errors[0].SetClass(value);
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public SqlErrorCollection Errors {
|
|
get {
|
|
return errors;
|
|
}
|
|
|
|
set {
|
|
errors = value;
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public int LineNumber {
|
|
get {
|
|
if(errors.Count == 0)
|
|
return 0; // FIXME: throw exception here?
|
|
return errors[0].LineNumber;
|
|
}
|
|
|
|
set {
|
|
errors[0].SetLineNumber(value);
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public override string Message {
|
|
get {
|
|
if(errors.Count == 0)
|
|
return ""; // FIXME: throw exception?
|
|
else {
|
|
String msg = "";
|
|
int i = 0;
|
|
|
|
for(i = 0; i < errors.Count - 1; i++) {
|
|
msg = msg + errors[i].Message + "\n";
|
|
}
|
|
msg = msg + errors[i];
|
|
|
|
return msg;
|
|
}
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public int Number {
|
|
get {
|
|
if(errors.Count == 0)
|
|
return 0; // FIXME: throw exception?
|
|
else
|
|
return errors[0].Number;
|
|
}
|
|
|
|
set {
|
|
errors[0].SetNumber(value);
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public string Procedure {
|
|
get {
|
|
if(errors.Count == 0)
|
|
return ""; // FIXME: throw exception?
|
|
else
|
|
return errors[0].Procedure;
|
|
}
|
|
|
|
set {
|
|
errors[0].SetProcedure(value);
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public string Server {
|
|
get {
|
|
if(errors.Count == 0)
|
|
return ""; // FIXME: throw exception?
|
|
else
|
|
return errors[0].Server;
|
|
}
|
|
|
|
set {
|
|
errors[0].SetServer(value);
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public override string Source {
|
|
get {
|
|
if(errors.Count == 0)
|
|
return ""; // FIXME: throw exception?
|
|
else
|
|
return errors[0].Source;
|
|
}
|
|
|
|
set {
|
|
errors[0].SetSource(value);
|
|
}
|
|
}
|
|
|
|
[MonoTODO]
|
|
public byte State {
|
|
get {
|
|
if(errors.Count == 0)
|
|
return 0; // FIXME: throw exception?
|
|
else
|
|
return errors[0].State;
|
|
}
|
|
|
|
set {
|
|
errors[0].SetState(value);
|
|
}
|
|
}
|
|
|
|
#endregion // Properties
|
|
|
|
#region Methods
|
|
|
|
[MonoTODO]
|
|
public override void GetObjectData(SerializationInfo si,
|
|
StreamingContext context) {
|
|
// FIXME: to do
|
|
}
|
|
|
|
// [Serializable]
|
|
// [ClassInterface(ClassInterfaceType.AutoDual)]
|
|
public override string ToString() {
|
|
String toStr = "";
|
|
for (int i = 0; i < errors.Count; i++) {
|
|
toStr = toStr + errors[i].ToString() + "\n";
|
|
}
|
|
return toStr;
|
|
}
|
|
|
|
internal void Add(byte theClass, int lineNumber,
|
|
string message, int number, string procedure,
|
|
string server, string source, byte state) {
|
|
|
|
errors.Add (theClass, lineNumber, message,
|
|
number, procedure,
|
|
server, source, state);
|
|
}
|
|
|
|
[MonoTODO]
|
|
~SqlException() {
|
|
// FIXME: destructor to release resources
|
|
}
|
|
|
|
#endregion // Methods
|
|
}
|
|
}
|