[plt-scheme] trying to learn scheme and use sqlite.ss

From: Mike Eggleston (mikeegg1 at me.com)
Date: Fri Jan 23 09:58:18 EST 2009

On Fri, 23 Jan 2009, Jay McCarthy might have said:

> The require line should be:
> 
>  (require (planet jaymccarthy/sqlite:3))
> 
> As it says in the documentation:
> 
> http://coach.cs.uchicago.edu:8080/package-source/jaymccarthy/sqlite.plt/3/7/planet-docs/sqlite/index.html
> 
> That corresponds to how the code you're looking at requires "sqlite.ss".
> 
> Jay
> 
> On Fri, Jan 23, 2009 at 6:53 AM, Mike Eggleston <mikeegg1 at me.com> wrote:
> > Morning,
> >
> > In DrScheme I enter in the lower window:
> >
> >> (require (planet "main.ss" ("schematics" "schemeunit.plt" 3 3)))
> >> (define dbh (open (string->path "mikee.sql3")))
> > . open: illegal use of signature form in: (open (string->path "mikee.sql3"))
> >
> > So the require is working (good), but the open is not working. I
> > don't understand what violation I have in the syntax. To
> > my so far limited understanding I'm following the code at
> > <http://coach.cs.uchicago.edu:8080/package-source/jaymccarthy/sqlite.plt/3/7/sqlite-test.ss>.
> >
> > What am I missing here?
> >
> > Mike

Thank you, Jay.
My test program is now:

#lang scheme
(require (prefix-in sqlite: (planet jaymccarthy/sqlite:3/sqlite)))
(define db (sqlite:open (string->path "mikee.sql3")))
(sqlite:exec/ignore db "CREATE TABLE user ( user_id INTEGER PRIMARY KEY, name TEXT )")
(sqlite:insert db "INSERT INTO user (name) VALUES ('noel')")
(sqlite:insert db "INSERT INTO user (name) VALUES ('matt')")
(sqlite:insert db "INSERT INTO user (name) VALUES ('dave')")
(sqlite:select db "select * from user")
(sqlite:close db)
(delete-file "mikee.sql3")

The resulting file size is 2048 bytes.

Mike


Posted on the users mailing list.