All Manuals > LispWorks User Guide and Reference Manual > 23 Common SQL

NextPrevUpTopContentsIndex

23.8 Error handling in Common SQL

All errors generated by Common SQL are of type sql-user-error or sql-database-error. You can test for these conditions and their subtypes in your error handlers.

23.8.1 SQL condition classes

An sql-user-error is an error inside Lisp.

An sql-database-error is an error inside the database interface that Lisp uses.

The following are subclasses of sql-database-error:

sql-database-data-error

An error with the data given. It signifies an error that must be fixed for the code to work.

sql-timeout-error

Signifies an error that is a result of other users using the same database. It means the code can work without change, once the other users stop using the database.

sql-connection-error

An error with the connection to the RDBMS.

The following are subclasses of sql-connection-error:

sql-timeout-error

A timeout with some operation.

sql-fatal-error

An error which means that the connection is no longer usable.

Note: In general, the documentation for the various supported databases make it difficult to decide which error code should be made into which of the above condition class, and we probably get many of these wrong. If you find errors that seem to be signaled with the wrong condition class, please report them to Lisp Support, including the full printout of the condition, and we will fix it.

23.8.2 Database error accessors

Three functions are provided which access slots of sql-database-error, allowing you to discover more about the actual error that occurred.

sql-error-error-id and sql-error-secondary-error-id return primary and secondary error identifiers. If you use these, please read the detailed description in sql-database-error.

sql-error-database-message is a string (maybe nil) returned by the foreign code.


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex