Package org.mariadb.jdbc.export
Class ExceptionFactory
java.lang.Object
org.mariadb.jdbc.export.ExceptionFactory
- Direct Known Subclasses:
ExceptionFactory.SqlExceptionFactory
Exception factory. This permit common error logging, with thread id, dump query, and specific
dead-lock additional information
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Exception with SQL command -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Configuration
private Connection
private final HostAddress
private MariaDbPoolConnection
private Statement
private long
-
Constructor Summary
ConstructorsModifierConstructorDescriptionExceptionFactory
(Configuration conf, HostAddress hostAddress) Connection Exception factory constructorprivate
ExceptionFactory
(Connection connection, MariaDbPoolConnection poolConnection, Configuration conf, HostAddress hostAddress, long threadId, Statement statement) -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
buildMsgText
(String initialMessage, long threadId, Configuration conf, String sql, int errorCode, Connection connection) Creation of an exceptionCreation of an exceptionCreation of an exceptionCreation of an exceptioncreateBatchUpdate
(List<Completion> res, int length, int[] responseMsg, SQLException sqle) Create a BatchUpdateException, filling successful updatescreateBatchUpdate
(List<Completion> res, int length, SQLException sqle) Create a BatchUpdateException, filling successful updatesprivate SQLException
createException
(String initialMessage, String sqlState, int errorCode, Exception cause) getSql()
get SQL commandnotSupported
(String message) fast creation of SQLFeatureNotSupportedException exceptionConstruct an Exception factory from this + adding current statementsetConnection
(Connection connection) Set connection to factoryvoid
setConnection
(ExceptionFactory oldExceptionFactory) Set connectionsetPoolConnection
(MariaDbPoolConnection internalPoolConnection) Set pool connection to factoryvoid
setThreadId
(long threadId) Set connection thread idConstruct an Exception factory from this + adding current SQL
-
Field Details
-
LOCK_DEADLOCK_ERROR_CODES
-
conf
-
hostAddress
-
connection
-
poolConnection
-
threadId
private long threadId -
statement
-
-
Constructor Details
-
ExceptionFactory
Connection Exception factory constructor- Parameters:
conf
- configurationhostAddress
- current host
-
ExceptionFactory
private ExceptionFactory(Connection connection, MariaDbPoolConnection poolConnection, Configuration conf, HostAddress hostAddress, long threadId, Statement statement)
-
-
Method Details
-
buildMsgText
private static String buildMsgText(String initialMessage, long threadId, Configuration conf, String sql, int errorCode, Connection connection) -
setConnection
Set connection- Parameters:
oldExceptionFactory
- previous connection exception factory
-
setConnection
Set connection to factory- Parameters:
connection
- connection- Returns:
- this
ExceptionFactory
-
setPoolConnection
Set pool connection to factory- Parameters:
internalPoolConnection
- internal pool connection- Returns:
- this
ExceptionFactory
-
setThreadId
public void setThreadId(long threadId) Set connection thread id- Parameters:
threadId
- connection thread id
-
createBatchUpdate
Create a BatchUpdateException, filling successful updates- Parameters:
res
- completion listlength
- expected sizesqle
- exception- Returns:
- BatchUpdateException object
-
createBatchUpdate
public BatchUpdateException createBatchUpdate(List<Completion> res, int length, int[] responseMsg, SQLException sqle) Create a BatchUpdateException, filling successful updates- Parameters:
res
- completion listlength
- expected lengthresponseMsg
- successful responsesqle
- exception- Returns:
- BatchUpdateException object
-
of
Construct an Exception factory from this + adding current statement- Parameters:
statement
- current statement- Returns:
- new Exception factory
-
withSql
Construct an Exception factory from this + adding current SQL- Parameters:
sql
- current sql command- Returns:
- new Exception factory
-
createException
private SQLException createException(String initialMessage, String sqlState, int errorCode, Exception cause) -
notSupported
fast creation of SQLFeatureNotSupportedException exception- Parameters:
message
- error message- Returns:
- exception to be thrown
-
create
Creation of an exception- Parameters:
message
- error message- Returns:
- exception to be thrown
-
create
Creation of an exception- Parameters:
message
- error messagesqlState
- sql state- Returns:
- exception to be thrown
-
create
Creation of an exception- Parameters:
message
- error messagesqlState
- sql statecause
- initial exception- Returns:
- exception to be thrown
-
create
Creation of an exception- Parameters:
message
- error messagesqlState
- sql stateerrorCode
- error code- Returns:
- exception to be thrown
-
getSql
get SQL command- Returns:
- sql command
-