Changeset error-handling,4


Ignore:
Timestamp:
01/17/2008 11:35:17 PM (18 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
error-handling
revision id:
dsowen@fugue88.ws-20080117233517-vus49ythg3fulf0z
Message:

Added some more errors.

Location:
error-handling/src/odbc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • error-handling/src/odbc/odbc-functions.lisp

    r3 r4  
    120120  (:report print-odbc-error))
    121121
     122(define-condition odbc-not-null-violation (odbc-error) ())
     123
    122124(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) ())
    123133
    124134(defun read-and-throw-error (henv hdbc hstmt)
     
    127137                    (or hdbc (cffi:null-pointer))
    128138                    (or hstmt (cffi:null-pointer)))
    129     (let ((type (cdr (assoc sql-state '(("23503" . odbc-foreign-key-error))
     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))
    130145                            :test #'string=))))
    131146      (error (if type type 'odbc-error)
  • error-handling/src/odbc/plain-odbc-package.lisp

    r3 r4  
    1313  (:export
    1414   "ODBC-ERROR"
    15    "ODBC-FOREIGN-KEY-ERROR"
     15   "ERROR-MESSAGE"
     16   "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"
    1623
    1724   "EXEC-QUERY"
Note: See TracChangeset for help on using the changeset viewer.