Changeset error-handling,5
- Timestamp:
- 01/18/2008 12:58:17 AM (18 years ago)
- branch-nick:
- error-handling
- revision id:
- dsowen@fugue88.ws-20080118005817-3jz82tlxi9e09uk4
- Location:
- error-handling
- Files:
-
- 2 added
- 3 edited
-
src/odbc/error-base.lisp (added)
-
src/odbc/error-defs.lisp (added)
-
plain-odbc.asd (modified) (1 diff)
-
src/odbc/odbc-functions.lisp (modified) (1 diff)
-
src/odbc/plain-odbc-package.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
error-handling/plain-odbc.asd
r1 r5 11 11 (:file "cffi-support") 12 12 (:file "odbc-ff-interface") 13 (:file "error-base") 14 (:file "error-defs") 13 15 (:file "odbc-functions") 14 16 (:file "parameter") -
error-handling/src/odbc/odbc-functions.lisp
r4 r5 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: -
error-handling/src/odbc/plain-odbc-package.lisp
r4 r5 12 12 "COMMON-LISP" #+mcl "CCL" #+cormanlisp "WIN32" "CFFI") 13 13 (:export 14 "PRINT-ODBC-ERROR" 14 15 "ODBC-ERROR" 15 16 "ERROR-MESSAGE" 16 17 "ERROR-CODE" 17 "ODBC-NOT-NULL-VIOLATION"18 "ODBC-FOREIGN-KEY-VIOLATION"19 "ODBC-UNIQUE-VIOLATION"20 "ODBC-CHECK-VIOLATION"21 "ODBC-INSUFFICIENT-PRIVILEGE"22 "ODBC-UNDEFINED-OBJECT"23 18 24 19 "EXEC-QUERY"
Note: See TracChangeset
for help on using the changeset viewer.
