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 Modifier and Type Method Description String
getErrorMessage()
Returns error message as received from SQL Serverint
getErrorNumber()
Returns error number as received from SQL Serverint
getErrorSeverity()
Returns Severity of error (as int value) as received from SQL Serverint
getErrorState()
Returns error state as received from SQL Serverlong
getLineNumber()
Returns line number where the error occurred in Stored Procedure returned bygetProcedureName()
as received from SQL ServerString
getProcedureName()
Returns name of the stored procedure where exception occurs as received from SQL ServerString
getServerName()
Returns name of the server where exception occurs as received from SQL ServerSQLServerError
getSQLServerMessage()
Returns SQLServerError containing detailed info about SQL Server Message as received from SQL Server.SQLException
toSqlExceptionOrSqlWarning()
Creates a SQLServerException or SQLServerWarning from this SQLServerMessageISQLServerMessage
toSQLServerError()
Upgrade a Info message into a Error messageISQLServerMessage
toSQLServerError(int newErrorSeverity)
Upgrade a Info message into a Error messageISQLServerMessage
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 interfaceISQLServerMessage
- Returns:
- SQLServerError
-
getErrorMessage
public String getErrorMessage()
Description copied from interface:ISQLServerMessage
Returns error message as received from SQL Server- Specified by:
getErrorMessage
in interfaceISQLServerMessage
- Returns:
- Error Message
-
getErrorNumber
public int getErrorNumber()
Description copied from interface:ISQLServerMessage
Returns error number as received from SQL Server- Specified by:
getErrorNumber
in interfaceISQLServerMessage
- Returns:
- Error Number
-
getErrorState
public int getErrorState()
Description copied from interface:ISQLServerMessage
Returns error state as received from SQL Server- Specified by:
getErrorState
in interfaceISQLServerMessage
- 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 interfaceISQLServerMessage
- 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 interfaceISQLServerMessage
- 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 interfaceISQLServerMessage
- Returns:
- Procedure Name
-
getLineNumber
public long getLineNumber()
Description copied from interface:ISQLServerMessage
Returns line number where the error occurred in Stored Procedure returned bygetProcedureName()
as received from SQL Server- Specified by:
getLineNumber
in interfaceISQLServerMessage
- Returns:
- Line Number
-
toSQLServerError
public ISQLServerMessage toSQLServerError()
Upgrade a Info message into a Error messageThis 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 messageThis 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 messageThis 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 interfaceISQLServerMessage
- Returns:
- SQLServerException if it's a SQLServerError object
- SQLServerWarning if it's a SQLServerInfoMessage object
-
-