[plt-scheme] SrPersist Question

From: Sanjay Pande (sanjaypande at yahoo.com)
Date: Fri May 21 13:58:01 EDT 2004

I am using SrPersist to connect PLT-Scheme to MySQL on
Mac OS X. I am using the following code which makes it
easy for me to query and uses some procedures borrowed
from the SchemeQL odbc.ss file.

(define (retrieve-data dbname user password
  (let ((all-records null))
    (let ((henv (alloc-env)))
      (let ((hdbc (alloc-connect henv)))
          (connect hdbc dbname user password)
          (let ((hstmt (alloc-stmt hdbc)))
              (prepare hstmt sql-statement)
              (sql-execute hstmt)
              (let-values (((buffers indicators
columns) (create-column-buffers hstmt)))
                    ([(lambda (exn) (exn-no-data?
                      (lambda (exn) (reverse
                  (let loop ()
                    (fetch hstmt)
                    (let ((record (apply append (map
read-buffer buffers))))
                      (set! all-records (cons record

I call this as followes

(retrieve-data "mysqltest" "mysql" "" "select * from

I got this working after some struggle and I wonder if
an explicit close to the connection is required

Sidebar : I think there is a bug in the dependent SQL
types in the dependent-sql-types proc in the schemeql
odbc.ss file which tries to return 'sql-c-numeric and
gives an error.

Do you Yahoo!?
Yahoo! Domains – Claim yours for only $14.70/year

Posted on the users mailing list.