Installation guide
mxODBC - Python ODBC Database Interface
|__OperationalError
|__IntegrityError
|__InternalError
|__ProgrammingError
|__NotSupportedError
10.2 SQL Error Mappings
If you are interested in the exact mapping of SQL error codes to exception classes,
have a look at the
errorclass dictionary which is defined at subpackage scope,
e.g.
mx.ODBC.Windows.errorclass.
errorclass
The errorclass dictionary maps SQLSTATE strings to error classes and is
used by mxODBC to determine which Python exception class to use for
reporting the database error within the Python application.
If you need to specify your own SQLSTATE to exception mappings, you can
assign to the
errorclass dictionary.
10.3 Exception Value Format
All ODBC driver generated exceptions use a standard exception value layout.
The error value will always be a tuple
(sqlstate, sqlcode, messagetext,
lineno)
with the following meanings:
sqlstate
SQL state as string; these values are defined in the ODBC Documentation and
by the ODBC driver/manager.
sqlcode
Numeric SQL error code as integer; these values are defined in the ODBC
Documentation and by the ODBC driver/manager.
messagetext
Message text as string explaining the error. These strings usually have the
format "[Vendor][Driver][Database] Message Text".
lineno
Line number in the mxODBC source code which generated the message. This
is very useful for support purposes.
160