# CLSQL Condition System

&clsql; provides and uses a condition system in which all errors and warnings are of type sql-condition. This section describes the various subclasses of sql-condition defined by &clsql;. Details are also provided for how they are used in &clsql; and intended to be signalled in user code. Finally, slot accessors for some of the condition types are described.

*BACKEND-WARNING-BEHAVIOR*

*BACKEND-WARNING-BEHAVIOR*

Controls behaviour on warnings from underlying RDBMS.

Variable

### Value Type

Meaningful values are :warn, :error, :ignore and &nil;.

### Initial Value

:warn

### Description

Action to perform on warning messages from backend. Default is to :warn. May also be set to :error to signal an error or :ignore or &nil; to silently ignore the warning.

### Examples

### Affected By

None.

### See Also

None.

### Notes

*backend-warning-behaviour* is a &clsql; extension.

SQL-CONDITION

SQL-CONDITION

the super-type of all &clsql;-specific conditions

Condition Type

### Class Precedence List

- sql-condition
- condition
- t

### Description

This is the super-type of all &clsql;-specific conditions defined by &clsql;, or any of it's database-specific interfaces. There are no defined initialization arguments nor any accessors.

### Notes

sql-condition is a &clsql; extension.

SQL-ERROR

SQL-ERROR

the super-type of all &clsql;-specific errors

Condition Type

### Class Precedence List

- sql-error
- simple-error
- simple-condition
- error
- serious-condition
- sql-condition
- condition
- t

### Description

This is the super-type of all &clsql;-specific conditions that represent errors, as defined by &clsql;, or any of it's database-specific interfaces. There are no defined initialization arguments nor any accessors.

### Notes

sql-error is a &clsql; extension.

SQL-WARNING

SQL-WARNING

the super-type of all &clsql;-specific warnings

Condition Type

### Class Precedence List

- sql-warning
- warning
- sql-condition
- condition
- t

### Description

This is the super-type of all &clsql;-specific conditions that represent warnings, as defined by &clsql;, or any of it's database-specific interfaces. There are no defined initialization arguments nor any accessors.

### Notes

sql-warning is a &clsql; extension.

SQL-DATABASE-WARNING

SQL-DATABASE-WARNING

Used to warn while accessing a &clsql; database.

Condition Type

### Class Precedence List

- sql-database-warning
- sql-warning
- warning
- sql-condition
- condition
- t

### Description

This condition represents warnings signalled while accessing a database.

The following initialization arguments and accessors exist:

Initarg Accessor Description
- :database `sql-warning-database` The database object that was involved in the incident.

### Notes

sql-database-warning is a &clsql; extension.

SQL-USER-ERROR

SQL-USER-ERROR

condition representing errors because of invalid parameters from the library user.

Condition Type

### Class Precedence List

- sql-user-error
- sql-error
- simple-error
- simple-condition
- error
- serious-condition
- sql-condition
- condition
- t

### Description

This condition represents errors that occur because the user supplies invalid data to &clsql;. This includes errors such as an invalid format connection specification or an error in the syntax for the `LOOP` macro extensions.

The following initialization arguments and accessors exist:

Initarg Accessor Description
- :message `sql-user-error-message` The error message.

### Notes

The slot accessor `sql-user-error-message` is a &clsql; extension.

SQL-DATABASE-ERROR

SQL-DATABASE-ERROR

condition representing errors during query or command execution

Condition Type

### Class Precedence List

- sql-database-error
- sql-error
- simple-error
- simple-condition
- error
- serious-condition
- sql-condition
- condition
- t

### Description

This condition represents errors that occur while executing SQL statements, either as part of query operations or command execution, either explicitly or implicitly, as caused e.g. by `with-transaction`.

The following initialization arguments and accessors exist:

Initarg Accessor Description
- :database `sql-error-database` The database object that was involved in the incident.
- :error-id `sql-error-error-id` The numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :secondary-error-id `sql-error-secondary-error-id` The secondary numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :message `sql-error-database-message` A string describing the problem that occurred, possibly one returned by the database back-end.

### Notes

The slot accessor `sql-error-database` is a &clsql; extension.

SQL-CONNECTION-ERROR

SQL-CONNECTION-ERROR

condition representing errors during connection

Condition Type

### Class Precedence List

- sql-connection-error
- sql-database-error
- sql-error
- simple-error
- simple-condition
- error
- serious-condition
- sql-condition
- condition
- t

### Description

This condition represents errors that occur while trying to connect to a database.

The following initialization arguments and accessors exist:

Initarg Accessor Description
- :database-type `sql-error-database-type` Database type for the connection attempt
- :connection-spec `sql-error-connection-spec` The connection specification used in the connection attempt.
- :database `sql-error-database` The database object that was involved in the incident.
- :error-id `sql-error-error-id` The numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :secondary-error-id `sql-error-secondary-error-id` The secondary numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :message `sql-database-error-error` A string describing the problem that occurred, possibly one returned by the database back-end.

### Notes

The slot accessors `sql-error-database`, `sql-error-database-type` and `sql-error-connection-spec` are &clsql; extensions.

SQL-DATABASE-DATA-ERROR

SQL-DATABASE-DATA-ERROR

Used to signal an error with the SQL data passed to a database.

Condition Type

### Class Precedence List

- sql-database-data-error
- sql-database-error
- sql-error
- simple-error
- simple-condition
- error
- serious-condition
- sql-condition
- condition
- t

### Description

This condition represents errors that occur while executing SQL statements, specifically as a result of malformed SQL expressions.

The following initialization arguments and accessors exist:

Initarg Accessor Description
- :expression `sql-error-expression` The SQL expression whose execution caused the error.
- :database `sql-error-database` The database object that was involved in the incident.
- :error-id `sql-error-error-id` The numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :secondary-error-id `sql-error-secondary-error-id` The secondary numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :message `sql-error-database-message` A string describing the problem that occurred, possibly one returned by the database back-end.

### Notes

The slot accessors `sql-error-database` and `sql-error-expression` are &clsql; extensions.

SQL-TEMPORARY-ERROR

SQL-TEMPORARY-ERROR

Used to signal a temporary error in the database backend.

Condition Type

### Class Precedence List

- sql-temporary-error
- sql-database-error
- sql-error
- simple-error
- simple-condition
- error
- serious-condition
- sql-condition
- condition
- t

### Description

This condition represents errors occurring when the database cannot currently process a valid interaction because, for example, it is still executing another command possibly issued by another user.

The following initialization arguments and accessors exist:

Initarg Accessor Description
- :database `sql-error-database` The database object that was involved in the incident.
- :error-id `sql-error-error-id` The numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :secondary-error-id `sql-error-secondary-error-id` The secondary numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :message `sql-error-database-message` A string describing the problem that occurred, possibly one returned by the database back-end.

### Notes

The slot accessor `sql-error-database` is a &clsql; extension.

SQL-TIMEOUT-ERROR

SQL-TIMEOUT-ERROR

condition representing errors when a connection times out.

Condition Type

### Class Precedence List

- sql-connection-error
- sql-database-error
- sql-error
- simple-error
- simple-condition
- error
- serious-condition
- sql-condition
- condition
- t

### Description

This condition represents errors that occur when the database times out while processing some operation. The following initialization arguments and accessors exist:

Initarg Accessor Description
- :database-type `sql-error-database-type` Database type for the connection attempt
- :connection-spec `sql-error-connection-spec` The connection specification used in the connection attempt.
- :database `sql-error-database` The database object that was involved in the incident.
- :error-id `sql-error-error-id` The numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :secondary-error-id `sql-error-secondary-error-id` The secondary numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :message `sql-error-database-message` A string describing the problem that occurred, possibly one returned by the database back-end.

### Notes

The slot accessors `sql-error-database`, `sql-error-database-type` and `sql-error-connection-spec` are &clsql; extensions.

SQL-FATAL-ERROR

SQL-FATAL-ERROR

condition representing a fatal error in a database connection

Condition Type

### Class Precedence List

- sql-connection-error
- sql-database-error
- sql-error
- simple-error
- simple-condition
- error
- serious-condition
- sql-condition
- condition
- t

### Description

This condition represents errors occurring when the database connection is no longer usable.

The following initialization arguments and accessors exist:

Initarg Accessor Description
- :database-type `sql-error-database-type` Database type for the connection attempt
- :connection-spec `sql-error-connection-spec` The connection specification used in the connection attempt.
- :database `sql-error-database` The database object that was involved in the incident.
- :error-id `sql-error-error-id` The numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :secondary-error-id `sql-error-secondary-error-id` The secondary numeric or symbolic error specification returned by the database back-end. The values and semantics of this are interface specific.
- :message `sql-error-database-message` A string describing the problem that occurred, possibly one returned by the database back-end.

### Notes

The slot accessors `sql-error-database`, `sql-error-database-type` and `sql-error-connection-spec` are &clsql; extensions.