org.mariadb.jdbc.internal.util.dao

## Class QueryException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - org.mariadb.jdbc.internal.util.dao.QueryException

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  PrepareException, ReconnectDuringTransactionException

    public class QueryException
    extends Exception

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`QueryException(String message)` Creates a default query exception with errorCode -1 and sqlState HY0000.
`QueryException(String message, ExceptionCode exceptionCode)` Creates a query exception with a message.
`QueryException(String message, int errorCode, SqlStates sqlState)` Creates a query exception with a message.
`QueryException(String message, int errorCode, SqlStates sqlState, Throwable cause)` Creates a query exception with a message and a cause.
`QueryException(String message, int errorCode, String sqlState)` Creates a query exception with a message.
`QueryException(String message, int errorCode, String sqlState, Throwable cause)` Creates a query exception with a message and a cause.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `getErrorCode()` returns the error code.
`String` `getMessage()`
`QueryException` `getNextException()`
`String` `getSqlState()` Gets the sql state.
`boolean` `isPrepareError()` Indicate if Exception is due to query not preparable.
`void` `setMessage(String message)`
`void` `setNextException(QueryException ex)` Adds an `QueryException` object to the end of the chain.
`void` `setSqlState(String sqlState)` Sets the sql state.

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

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

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

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

### Constructor Detail

#### QueryException

    public QueryException(String message)

Creates a default query exception with errorCode -1 and sqlState HY0000.

Parameters:
  `message` - the message to set

#### QueryException

    public QueryException(String message,
                          int errorCode,
                          String sqlState)

Creates a query exception with a message.

Parameters:
  `message` - the message
  `errorCode` - the error code
  `sqlState` - the sqlstate

#### QueryException

    public QueryException(String message,
                          int errorCode,
                          SqlStates sqlState)

Creates a query exception with a message.

Parameters:
  `message` - the message
  `errorCode` - the error code
  `sqlState` - the sqlstate

#### QueryException

    public QueryException(String message,
                          ExceptionCode exceptionCode)

Creates a query exception with a message.

Parameters:
  `message` - the message
  `exceptionCode` - exceptionCode

#### QueryException

    public QueryException(String message,
                          int errorCode,
                          String sqlState,
                          Throwable cause)

Creates a query exception with a message and a cause.

Parameters:
  `message` - the exception message
  `errorCode` - the error code
  `sqlState` - the sql state
  `cause` - the cause of the exception

#### QueryException

    public QueryException(String message,
                          int errorCode,
                          SqlStates sqlState,
                          Throwable cause)

Creates a query exception with a message and a cause.

Parameters:
  `message` - the exception message
  `errorCode` - the error code
  `sqlState` - the sql state
  `cause` - the cause of the exception

### Method Detail

#### getMessage

    public String getMessage()

Overrides:
  `getMessage` in class `Throwable`

#### setMessage

    public void setMessage(String message)

#### isPrepareError

    public boolean isPrepareError()

Indicate if Exception is due to query not preparable.

Returns:
  is excption due because query isn't preparable

#### getErrorCode

    public final int getErrorCode()

returns the error code.

Returns:
  the error code

#### getSqlState

    public final String getSqlState()

Gets the sql state.

Returns:
  the sql state

#### setSqlState

    public void setSqlState(String sqlState)

Sets the sql state.

Parameters:
  `sqlState` - sqlState

#### setNextException

    public void setNextException(QueryException ex)

Adds an `QueryException` object to the end of the chain.

Parameters:
  `ex` - the new exception that will be added to the end of the `QueryException` chain

#### getNextException

    public QueryException getNextException()