made the datetest table have a key column so that update-records-from-* works again
[clsql.git] / db-postgresql-socket3 / api.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:     postgresql-socket-api.lisp
6 ;;;; Purpose:  Low-level PostgreSQL interface using sockets
7 ;;;; Authors:  Kevin M. Rosenberg based on original code by Pierre R. Mai
8 ;;;; Created:  Feb 2002
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of CLSQL, is Copyright (c) 2002-2004 by Kevin M. Rosenberg
13 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
14 ;;;;
15 ;;;; CLSQL users are granted the rights to distribute and use this software
16 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
17 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
18 ;;;; *************************************************************************
19
20 (in-package #:postgresql-socket3)
21
22 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :postgresql-socket3)))
23   t)
24
25 (defmethod clsql-sys:database-type-library-loaded ((database-type
26                                           (eql :postgresql-socket3)))
27   "T if foreign library was able to be loaded successfully. Always true for
28 socket interface"
29   t)
30
31 (defparameter +postgresql-server-default-port+ 5432
32   "Default port of PostgreSQL server.")
33
34 ;;;; Condition hierarchy
35
36 (define-condition postgresql-condition (condition)
37   ((connection :initarg :connection :reader postgresql-condition-connection)
38    (message :initarg :message :reader postgresql-condition-message))
39   (:report
40    (lambda (c stream)
41      (format stream "~@<~A occurred on connection ~A. ~:@_Reason: ~A~:@>"
42              (type-of c)
43              (postgresql-condition-connection c)
44              (postgresql-condition-message c)))))
45
46 (define-condition postgresql-error (error postgresql-condition)
47   ())
48
49 (define-condition postgresql-fatal-error (postgresql-error)
50   ())
51
52 (define-condition postgresql-login-error (postgresql-fatal-error)
53   ())
54
55 (define-condition postgresql-warning (warning postgresql-condition)
56   ())
57
58 (define-condition postgresql-notification (postgresql-condition)
59   ()
60   (:report
61    (lambda (c stream)
62      (format stream "~@<Asynchronous notification on connection ~A: ~:@_~A~:@>"
63              (postgresql-condition-connection c)
64              (postgresql-condition-message c)))))