#| -*-Scheme-*-
-$Id: pgsql.scm,v 1.8 2003/11/11 04:46:39 cph Exp $
+$Id: pgsql.scm,v 1.9 2004/11/25 04:00:06 cph Exp $
Copyright 2003 Massachusetts Institute of Technology
set-result-handle!))
(set! pgsql-initialized? #t)))
#t)))
+
+(define (guarantee-pgsql-available)
+ (if (not (pgsql-available?))
+ (error "No PostgreSQL support in this sytem.")))
\f
(define condition-type:pgsql-error
(make-condition-type 'PGSQL-ERROR condition-type:error '()
(write-string "." port)))
\f
(define (open-pgsql-conn parameters #!optional wait?)
- (if (not (pgsql-available?))
- (error "No PostgreSQL support in this sytem."))
+ (guarantee-pgsql-available)
(let ((wait? (if (default-object? wait?) #t wait?)))
(make-gc-finalized-object
connections
(index->name (pq-status (connection->handle connection)) connection-status))
\f
(define (escape-pgsql-string string)
+ (guarantee-pgsql-available)
(let ((escaped (make-string (fix:* 2 (string-length string)))))
(set-string-maximum-length! escaped (pq-escape-string string escaped))
escaped))
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.517 2004/11/19 07:14:49 cph Exp $
+$Id: runtime.pkg,v 14.518 2004/11/25 04:00:21 cph Exp $
Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology
Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology
condition-type:pgsql-query-error
escape-pgsql-string
exec-pgsql-query
+ guarantee-pgsql-available
make-empty-pgsql-result
open-pgsql-conn
pgsql-available?