[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Database languages (was Re: Macros Make Me Mad)

On Sat, 16 Nov 2002, Neel Krishnaswami wrote:

>> Personally speaking, if any of the LL languages could demonstrate
>> such deep integration w/ SQL (esp. wrt dynamic tables etc.) that
>> could be something genuinely new and worth looking into.
>It seems like most of the internal applications people
>write these days involve database access. My own job was
>data-mining hooked up to a SQL database. I'd have loved to
>use a matrix language that knew SQL.

OK, disregarding that bit about matrix language, perhaps one
could use a syntax that's a bit more programmer-friendly
than SQL, and simply map it to an SQL backend when needed.

As an example, the DBMS that comes with Erlang/OTP has a
query language called mnemosyne. Its syntax is basically
based on list comprehension, and it integrates very well
into the Erlang language, where for example a transaction
with a query using the Erlang-based mnesia DBMS is modeled
as a higher-order function passed to the transaction

Handle =
       [ S.snb || S <- table(subscriber),
                  S.li = none]

AllAnswers =
         fun() ->

AFewAnswers =
         fun() ->
                 Cursor = mnemosyne:cursor(Handle),
                 L = mnemosyne:next_answers(Cursor,2,5),

Currently, this doesn't map to any SQL database, but I'm not
convinced that it couldn't. Anyway, a similar approach,
using the combination of list comprehensions and a
functional language to express DBMS queries seems to offer a
much more coherent and powerful environment than sticking to
the SQL syntax. It may not have quite the same mass

Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson Telecom AB, ATM Multiservice Networks