StatementException

class StatementException(val reason: StatementExceptionReason, val details: String? = null, val position: Int? = null, sqlState: String? = null, serverErrorMessage: ServerErrorMessage? = null) : OctaviusException

Exception thrown when an error occurs during the parsing, planning, or execution of a SQL statement.

This exception covers various query-related errors such as syntax errors, undefined objects, ambiguous references, and data type mismatches. If the database provides error positioning, this exception will format the original SQL query to visually indicate where the error occurred.

Every reason here is about the statement itself, which is what position is the evidence of: whether the server reported it or the driver's own parser did, there is somewhere in the SQL to point at.

Parameters

sqlState

The SQL state code returned by the database, if available.

serverErrorMessage

The original error message from the database server, if available.

Constructors

Link copied to clipboard
constructor(reason: StatementExceptionReason, details: String? = null, position: Int? = null, sqlState: String? = null, serverErrorMessage: ServerErrorMessage? = null)

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard

Additional context or hints provided by the database regarding the error.

Link copied to clipboard
open val message: String?
Link copied to clipboard

The 1-based character position in the SQL string where the error occurred, if available.

Link copied to clipboard

The context of the query that resulted in this exception, if applicable.

Link copied to clipboard

The categorized reason for the statement failure.

Link copied to clipboard

The raw error message received from the database, if applicable.

Link copied to clipboard

The SQL state code associated with the error, if applicable.

Functions

Link copied to clipboard

Finds the Octavius failure behind this throwable, if there is one.

Link copied to clipboard
open override fun getDetailedMessage(): String

Provides a detailed, human-readable description of the error.

Link copied to clipboard
open override fun toString(): String