class SQLDiagnostic
extends java.lang.Object
Assigns SQL state values in accordance to the native error number returned by the database server.
Modifier and Type | Field and Description |
---|---|
(package private) java.sql.SQLException |
exceptions |
(package private) java.sql.SQLException |
lastException |
(package private) java.sql.SQLWarning |
lastWarning |
private static java.util.HashMap |
mssqlStates
Map to convert Microsoft SQL server error codes to ANSI SQLSTATE codes.
|
private int |
serverType
SQL Server type.
|
private static java.util.HashMap |
sybStates
Map to convert Sybase SQL server error codes to ANSI SQLSTATE codes.
|
(package private) java.sql.SQLWarning |
warnings |
Constructor and Description |
---|
SQLDiagnostic(int serverType)
Create an SQL message for a specific server type.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addDiagnostic(int number,
int state,
int serverity,
java.lang.String message,
java.lang.String server,
java.lang.String procName,
int line)
Create a dianostic SQLException or SQLWarning.
|
(package private) void |
addException(java.sql.SQLException e) |
(package private) void |
addWarning(java.sql.SQLWarning w) |
(package private) void |
checkErrors()
Check the exception chain for errors and throw any found
as an SQLException.
|
(package private) void |
clearWarnings()
Clear the warning chain.
|
private static java.lang.String |
getStateCode(int number,
int serverType,
java.lang.String defState)
Map an SQL Server error code to an ANSI SQLSTATE code.
|
(package private) java.sql.SQLWarning |
getWarnings()
Return the warning chain.
|
private static final java.util.HashMap mssqlStates
private static final java.util.HashMap sybStates
private final int serverType
Driver.SQLSERVER
or
Driver.SYBASE
.java.sql.SQLException exceptions
java.sql.SQLException lastException
java.sql.SQLWarning warnings
java.sql.SQLWarning lastWarning
SQLDiagnostic(int serverType)
serverType
- either Driver.SQLSERVER
or Driver.SYBASE
void addWarning(java.sql.SQLWarning w)
void addException(java.sql.SQLException e)
void addDiagnostic(int number, int state, int serverity, java.lang.String message, java.lang.String server, java.lang.String procName, int line)
number
- SQL Server error number.state
- SQL Server state code.serverity
- SQL Server serverity > 10 = error.message
- SQL Server error message text.server
- SQL Server name.procName
- SQL Server stored procedure name.line
- SQL Server error line number in SQL source.void clearWarnings()
void checkErrors() throws java.sql.SQLException
java.sql.SQLException
java.sql.SQLWarning getWarnings()
SQLWarning
.private static java.lang.String getStateCode(int number, int serverType, java.lang.String defState)
number
- the SQL Server error numberserverType
- Driver.SQLSERVER
or Driver.SYBASE
defState
- the default state code to return if the mapping failsString
Generated on June 8 2013