[racket] Merits of 2 different methods of interfacing Racket to a database?

From: Don Green (infodeveloperdon at gmail.com)
Date: Mon Oct 1 08:42:44 EDT 2012

Please comment on the merits of 2 different methods of interfacing Racket
to a database.

 Is Method B preferable to Method A? If so, why?

 Method A

Instead of using the Racket fn:

(query-exec db1 "create temporary table table1 (...

I can use Racket's 'system' function, to issue SQLite3 sql command: create
table table1(...

and then issue SQLite3 dot commands such as '.import' to load a million
lines of data from a file into a new SQLite db.

I can then proceed to use Racket's SQL db access commands to insert or
select data.


 Method B

Racket fn:

(query-exec db1 "create temporary table table1 (...

Racket does not implement SQLite dot commands, so either:

a) write a million Racket SQL commands such as:

(query-exec db1 "insert into table1 values ('a1', 'b2' 'c3')")

(query-exec db1 "insert into table1 values ('aaa', 'bbb' 'ccc')")



 b) write a function:

(query-exec db1 "insert into table1 values (list-loop)")


(list-loop) is a function that loops through each of the million lines in a
data file that are intended for the database: db1.


I understand that creating a temporary table means that the table will be
disk based rather than memory based. Creating a table via a system call
would also create a disk based db.

Thanks again.
Filter settings
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121001/08df3caa/attachment.html>

Posted on the users mailing list.