Changeset combined,2.2.3 for combined/src/odbc/odbc-functions.lisp
- Timestamp:
- 01/18/2008 12:58:17 AM (18 years ago)
- branch-nick:
- error-handling
- revision id:
- dsowen@fugue88.ws-20080118005817-3jz82tlxi9e09uk4
- File:
-
- 1 edited
-
combined/src/odbc/odbc-functions.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
combined/src/odbc/odbc-functions.lisp
r2.2.2 r2.2.3 111 111 112 112 113 (defun print-odbc-error (condition stream)114 (with-slots (message code) condition115 (format stream "[ODBC error] ~a; state: ~a" message code)))116 117 (define-condition odbc-error (error)118 ((message :initarg :message :reader error-message)119 (code :initarg :code :reader error-code))120 (:report print-odbc-error))121 122 (define-condition odbc-not-null-violation (odbc-error) ())123 124 (define-condition odbc-foreign-key-error (odbc-error) ())125 126 (define-condition odbc-unique-violation (odbc-error) ())127 128 (define-condition odbc-check-violation (odbc-error) ())129 130 (define-condition odbc-insufficient-privilege (odbc-error) ())131 132 (define-condition odbc-undefined-object (odbc-error) ())133 134 (defun read-and-throw-error (henv hdbc hstmt)135 (multiple-value-bind (error-message sql-state)136 (handle-error (or henv (cffi:null-pointer))137 (or hdbc (cffi:null-pointer))138 (or hstmt (cffi:null-pointer)))139 (let ((type (cdr (assoc sql-state '(("23502" . odbc-not-null-violation)140 ("23503" . odbc-foreign-key-error)141 ("23505" . odbc-unique-violation)142 ("23514" . odbc-check-violation)143 ("42501" . odbc-insufficient-privilege)144 ("42704" . odbc-undefined-object))145 :test #'string=))))146 (error (if type type 'odbc-error)147 :message error-message148 :code sql-state))))149 113 150 114 ;;; rav:
Note: See TracChangeset
for help on using the changeset viewer.
