X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=db-postgresql-socket3%2Fapi.lisp;h=ad6ca1878f92cb524c96513b727218065b470d67;hb=814ef0649edf23f0136d5cad2d7738ae72e79871;hp=488252768ba922b43306a8bec995e0b92737fb18;hpb=9f2b1f47684151e0706d51540ab5424c005f3184;p=clsql.git diff --git a/db-postgresql-socket3/api.lisp b/db-postgresql-socket3/api.lisp index 4882527..ad6ca18 100644 --- a/db-postgresql-socket3/api.lisp +++ b/db-postgresql-socket3/api.lisp @@ -26,4 +26,39 @@ (eql :postgresql-socket3))) "T if foreign library was able to be loaded successfully. Always true for socket interface" - t) \ No newline at end of file + t) + +(defparameter +postgresql-server-default-port+ 5432 + "Default port of PostgreSQL server.") + +;;;; Condition hierarchy + +(define-condition postgresql-condition (condition) + ((connection :initarg :connection :reader postgresql-condition-connection) + (message :initarg :message :reader postgresql-condition-message)) + (:report + (lambda (c stream) + (format stream "~@<~A occurred on connection ~A. ~:@_Reason: ~A~:@>" + (type-of c) + (postgresql-condition-connection c) + (postgresql-condition-message c))))) + +(define-condition postgresql-error (error postgresql-condition) + ()) + +(define-condition postgresql-fatal-error (postgresql-error) + ()) + +(define-condition postgresql-login-error (postgresql-fatal-error) + ()) + +(define-condition postgresql-warning (warning postgresql-condition) + ()) + +(define-condition postgresql-notification (postgresql-condition) + () + (:report + (lambda (c stream) + (format stream "~@" + (postgresql-condition-connection c) + (postgresql-condition-message c))))) \ No newline at end of file