Module com.microsoft.sqlserver.jdbc
Package com.microsoft.sqlserver.jdbc

## Class SQLServerInfoMessage

- java.lang.Object
- - com.microsoft.sqlserver.jdbc.SQLServerInfoMessage

All Implemented Interfaces:
  `ISQLServerMessage`

    public final class SQLServerInfoMessage
    extends Object
    implements ISQLServerMessage

Holds information about SQL Server messages that is considered as Informational Messages (normally if SQL Server Severity is at 10)

Instead of just holding the SQL Server message (like a normal SQLWarning, it also holds all the SQL Servers extended information, like: ErrorSeverity, ServerName, ProcName etc

This enables client to print out extra information about the message.
Like: In what procedure was the message produced.

A SQLServerInfoMessage is produced when reading the TDS Stream and added to the Connection as a SQLServerWarning

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `getErrorMessage()` Returns error message as received from SQL Server
`int` `getErrorNumber()` Returns error number as received from SQL Server
`int` `getErrorSeverity()` Returns Severity of error (as int value) as received from SQL Server
`int` `getErrorState()` Returns error state as received from SQL Server
`long` `getLineNumber()` Returns line number where the error occurred in Stored Procedure returned by `getProcedureName()` as received from SQL Server
`String` `getProcedureName()` Returns name of the stored procedure where exception occurs as received from SQL Server
`String` `getServerName()` Returns name of the server where exception occurs as received from SQL Server
`SQLServerError` `getSQLServerMessage()` Returns SQLServerError containing detailed info about SQL Server Message as received from SQL Server.
`SQLException` `toSqlExceptionOrSqlWarning()` Creates a SQLServerException or SQLServerWarning from this SQLServerMessage
`ISQLServerMessage` `toSQLServerError()` Upgrade a Info message into a Error message
`ISQLServerMessage` `toSQLServerError​(int newErrorSeverity)` Upgrade a Info message into a Error message
`ISQLServerMessage` `toSQLServerError​(int newErrorSeverity, int newErrorNumber)` Upgrade a Info message into a Error message

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface com.microsoft.sqlserver.jdbc.ISQLServerMessage

`isErrorMessage, isInfoMessage`

### Method Detail

#### getSQLServerMessage

    public SQLServerError getSQLServerMessage()

Description copied from interface: `ISQLServerMessage`
Returns SQLServerError containing detailed info about SQL Server Message as received from SQL Server.

Specified by:
  `getSQLServerMessage` in interface `ISQLServerMessage`
Returns:
  SQLServerError

#### getErrorMessage

    public String getErrorMessage()

Description copied from interface: `ISQLServerMessage`
Returns error message as received from SQL Server

Specified by:
  `getErrorMessage` in interface `ISQLServerMessage`
Returns:
  Error Message

#### getErrorNumber

    public int getErrorNumber()

Description copied from interface: `ISQLServerMessage`
Returns error number as received from SQL Server

Specified by:
  `getErrorNumber` in interface `ISQLServerMessage`
Returns:
  Error Number

#### getErrorState

    public int getErrorState()

Description copied from interface: `ISQLServerMessage`
Returns error state as received from SQL Server

Specified by:
  `getErrorState` in interface `ISQLServerMessage`
Returns:
  Error State

#### getErrorSeverity

    public int getErrorSeverity()

Description copied from interface: `ISQLServerMessage`
Returns Severity of error (as int value) as received from SQL Server

Specified by:
  `getErrorSeverity` in interface `ISQLServerMessage`
Returns:
  Error Severity

#### getServerName

    public String getServerName()

Description copied from interface: `ISQLServerMessage`
Returns name of the server where exception occurs as received from SQL Server

Specified by:
  `getServerName` in interface `ISQLServerMessage`
Returns:
  Server Name

#### getProcedureName

    public String getProcedureName()

Description copied from interface: `ISQLServerMessage`
Returns name of the stored procedure where exception occurs as received from SQL Server

Specified by:
  `getProcedureName` in interface `ISQLServerMessage`
Returns:
  Procedure Name

#### getLineNumber

    public long getLineNumber()

Description copied from interface: `ISQLServerMessage`
Returns line number where the error occurred in Stored Procedure returned by `getProcedureName()` as received from SQL Server

Specified by:
  `getLineNumber` in interface `ISQLServerMessage`
Returns:
  Line Number

#### toSQLServerError

    public ISQLServerMessage toSQLServerError()

Upgrade a Info message into a Error message

This simply create a SQLServerError from this SQLServerInfoMessage, without changing the message content.

Returns:
  ISQLServerMessage

#### toSQLServerError

    public ISQLServerMessage toSQLServerError​(int newErrorSeverity)

Upgrade a Info message into a Error message

This simply create a SQLServerError from this SQLServerInfoMessage.

Parameters:
  `newErrorSeverity` - - The new ErrorSeverity
Returns:
  ISQLServerMessage

#### toSQLServerError

    public ISQLServerMessage toSQLServerError​(int newErrorSeverity,
                                              int newErrorNumber)

Upgrade a Info message into a Error message

This simply create a SQLServerError from this SQLServerInfoMessage.

Parameters:
  `newErrorSeverity` - - If you want to change the ErrorSeverity (-1: leave unchanged)
  `newErrorNumber` - - If you want to change the ErrorNumber (-1: leave unchanged)
Returns:
  ISQLServerMessage

#### toSqlExceptionOrSqlWarning

    public SQLException toSqlExceptionOrSqlWarning()

Description copied from interface: `ISQLServerMessage`
Creates a SQLServerException or SQLServerWarning from this SQLServerMessage

Specified by:
  `toSqlExceptionOrSqlWarning` in interface `ISQLServerMessage`
Returns:
  - SQLServerException if it's a SQLServerError object
  - SQLServerWarning if it's a SQLServerInfoMessage object