X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-postgresql-socket3%2Fapi.lisp;fp=db-postgresql-socket3%2Fapi.lisp;h=ad6ca1878f92cb524c96513b727218065b470d67;hb=6e49d313475d42d2ef7b4eea626f2d7da902d09e;hp=0000000000000000000000000000000000000000;hpb=fdc28505b82da26cc8142964cb8ae40cdc8bfdfc;p=clsql.git diff --git a/db-postgresql-socket3/api.lisp b/db-postgresql-socket3/api.lisp new file mode 100644 index 0000000..ad6ca18 --- /dev/null +++ b/db-postgresql-socket3/api.lisp @@ -0,0 +1,64 @@ +;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: postgresql-socket-api.lisp +;;;; Purpose: Low-level PostgreSQL interface using sockets +;;;; Authors: Kevin M. Rosenberg based on original code by Pierre R. Mai +;;;; Created: Feb 2002 +;;;; +;;;; $Id$ +;;;; +;;;; This file, part of CLSQL, is Copyright (c) 2002-2004 by Kevin M. Rosenberg +;;;; and Copyright (c) 1999-2001 by Pierre R. Mai +;;;; +;;;; CLSQL users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. +;;;; ************************************************************************* + +(in-package #:postgresql-socket3) + +(defmethod clsql-sys:database-type-load-foreign ((database-type (eql :postgresql-socket3))) + t) + +(defmethod clsql-sys:database-type-library-loaded ((database-type + (eql :postgresql-socket3))) + "T if foreign library was able to be loaded successfully. Always true for +socket interface" + 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