guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: the module system ?


From: David Pirotte
Subject: Re: the module system ?
Date: Wed, 07 Mar 2001 00:35:45 +0100

Mikael Djurfeldt wrote:
> ...
> Is it possible for you to cook it down to some minimal piece of code
> and put that as a tar-archive somewhere so that a Guile developer can
> get it and debug it?

if you download guile-pg, compile and install, you'll have the

        /usr/local/share/guile/database/...

        subtree as mine.

you can get it from:

        http://guile-pg.sourceforge.net

        [I can tar what I have, but I don't think it would make any 
         difference]


I use guile 1.4 and the latest guile-pg

of course, to be able to really make it work, you'll need postgres, I am
using PostgreSQL Version 7.0 (minimum required for guile-pg)

        [better to get, compile and install if you want because it's rather
         big! and probably not really necessary?]

and this is it, if you create the following 2 files anywhere in your
guile-load-path, you'll have a similar environment as mine

hope this is sufficient to reproduce the problem
otherwise let me know what misses ...

thanks,
david


;; ----------------------------------
;; my small example file db-stuff.scm

(define-module (alto db-stuff)

  ;; from distribution
  :use-module (database postgres)
  :use-module (ice-9 format)

  )

(export open-db
        close-db
        )

(setenv "PGDATESTYLE" "German")

(define (open-db dbname user . options)
  ;; (format #t "dbname=~A user=~A options=~S~%" dbname user options)
  (if (null? options)
      (pg-connectdb (format #f "dbname=~A user=~A" dbname user))
      (pg-connectdb (format #f "dbname=~A user=~A ~A" dbname user options)))
  )

(define (close-db . con?)
  '())

;; end-of-file
;;-----------------------------------



;; ----------------------------------
;; my small script example tactus.scm

#!/usr/local/bin/guile -s
!#

(use-modules (alto db-stuff))

(define pg-con
  (open-db "tactus" "david"))

(display pg-con)
(display "\n")

;; this is the way guile-pg recommand to close a Postgres connection
(set! pg-con '())

;; end-of-file
;;-----------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]