This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: db interface (was Re: Scheme is too complicated)


Sascha Ziemann <szi@aibon.ping.de> writes:

 > I would not prefer a wrapper around SQL.  That has the following
 > disadvantages:
 > 
 >   - This is a mapping from a functional to a declarative
 >     language.  This job is complicated and probably impossible.
 >   - Someone must write it.
 >   - Everybody must learn it.
 >   - It makes it probably impossible to use some DB special features.

Not necessarily.

 > And now the advantages:
 > 
 >   - ?

 - It's easier to generate queries programatically.
 - You'll end up doing it anyway.

What'll happen is that:

 1. You'll start embedding all these SQL strings into your program.
    You'll end up with things like (sql-send dbase "select ....").
 2. You'll want your program to start building requests by itself
    based on user inputs, so you'll start writing fcns which glue
    together pieces of sql by concatenating strings where appropriate.

At this point, you'll probably end up with something like (sql-send
dbase 'select ...) i.e. - a mapping from lists with keywords & data to
sql strings which makes the construction of these strings much easier.

We're better having such an interface from the start than having each
person growing his own version.

Not to mention the fact that there'd presumably also be an underlying
sql-send fcn that takes an SQL string so you can always do anything
that's inadvertently missing from the interface.

-- 
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il