Class 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 Detail

      • 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
      • 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