[plt-scheme] Working with database using scheme language

From: Rohan Golwala (ce.rohan at gmail.com)
Date: Mon Nov 24 15:33:10 EST 2008

Hi,

I have set up a connection to the database using postgreSQL but I have a few
questions while running the following queries:
> (send a-connection map a-statement *proc*)
  map : Statement (field ... -> 'a) -> (list-of 'a)

  Executes a SQL query and applies the given function to the contents
  of each row, returning a list of results.

> (send a-connection for-each a-statement *proc)*
  for-each : Statement (field ... -> void) -> void

  Executes a SQL query and applies the given function to the contents
  of each row, discarding the results.

> (send a-connection mapfilter a-statement *map-proc* *filter-proc*)
  mapfilter : Statement (field ... -> 'a) (field ... -> boolean) -> (list-of
'a)

  Like 'map', but applies the map procedure (given first) to only
  those rows which satisfy the given predicate (given second).

> (send a-connection fold a-statement *proc* init)
  fold : Statement ('a field ... -> 'a) 'a -> 'a

What should be the structure of the proc...? Can you send me one entire
example which explains the use of "*proc*" as well as "map-proc" and
"filter-proc" and their structure or the body of these functions....?

Any help would be much appreciated.

-- 
Rohan.B.Golwala
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20081124/1646aff0/attachment.html>

Posted on the users mailing list.