Class SqlCmdMessage
- Namespace
- ItTiger.TigerQuery.Events
- Assembly
- ItTiger.TigerQuery.dll
Represents a SQL Server informational/error message or an exception converted
to the engine's message model.
public sealed class SqlCmdMessage
- Inheritance
-
SqlCmdMessage
- Inherited Members
Fields
SeverityException
Gets the synthetic severity assigned to non-SQL exceptions.
public const byte SeverityException = 254
Field Value
SeverityFatalException
Gets the synthetic severity assigned to TigerQueryException.
public const byte SeverityFatalException = 255
Field Value
Properties
IsError
Gets whether the category is a warning, error, or exception.
public bool IsError { get; }
Property Value
IsFatalError
Gets whether the category is a fatal SQL error or fatal exception.
public bool IsFatalError { get; }
Property Value
LineNumber
Gets the SQL Server-reported one-based line number, or
null when unavailable.
public int? LineNumber { get; init; }
Property Value
- int?
Remarks
SQL Server line numbers are relative to the submitted batch.
Number
Gets the SQL Server error number, or -1 for converted exceptions.
public int Number { get; }
Property Value
Procedure
Gets the SQL Server stored-procedure name when one was reported.
public string? Procedure { get; }
Property Value
Severity
Gets the SQL Server or synthetic severity.
public byte Severity { get; init; }
Property Value
State
Gets the SQL Server state value, or zero for converted exceptions.
public byte State { get; }
Property Value
Text
Gets the message text.
public string Text { get; init; }
Property Value
Timestamp
Gets the UTC time at which the message object was created.
public DateTime Timestamp { get; init; }
Property Value
Type
Gets the category derived from Severity.
public SqlCmdMessageType Type { get; }
Property Value
Methods
FromException(Exception)
Creates a synthetic message from a non-SQL exception.
public static SqlCmdMessage FromException(Exception exception)
Parameters
exceptionException- The exception whose message and category are copied.
Returns
- SqlCmdMessage
- A fatal-exception message for TigerQueryException; otherwise a nonfatal exception message.
FromSqlError(SqlError)
Creates a message from a SQL Server error.
public static SqlCmdMessage FromSqlError(SqlError error)
Parameters
errorSqlError- The provider error to copy.
Returns
- SqlCmdMessage
- A message containing the provider's diagnostics.
ToString()
Formats the timestamp, category, severity, and message text.
public override string ToString()
Returns
- string
- A concise display string for the message.