SQL query tool question

Q&A's, tips, howto's
Locked
jeremyc
Posts: 33
Joined: Wed Dec 06, 2006 3:33 am

SQL query tool question

Post by jeremyc »

In my time of looking at different languages, one Scheme version had a SQL query generation package that I thought made working with SQL easier. For instance:

(sql:select '(a.name a.age b.date) '((as a person) (as b dobs)) '((= a.id b.id)))

I was thinking of making something similar in newLISP, but I am running into a problem with things like '((= a.id b.id)) ... I am not good with the quoting, unquoting, etc... yet. Maybe this project is beyond my skill, but how can I actually parse the (= a.id b.id) portion? or another example would be:

(sql:select '(a.name (count a.id)) ...)

the (count a.id) should obviously turn into COUNT(a.id) for SQL.

Thanks for any info.

Jeremy

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

This program: http://newlisp.org/index.cgi?page=S-expressions_to_XML is a good example how to translate LISP S-expressions into something else, like SQL in your case instaed of XML in the example.

Lutz

Locked