[erlang-questions] ErlSQL: easy expression and generation of SQL statements in Erlang

Vlad Dumitrescu <>
Sun Sep 17 11:17:24 CEST 2006


Hi,

> I created a small library, called ErlSQL, for expressing and genering
> SQL statements in Erlang. ErlSQL makes it easy to dynamically generate
> SQL-injection free statements from Erlang.

It looks cool, but feels like it could need some polishing.

For example, why

{delete,project,{a,'=',5}} ->
  "DELETE FROM project WHERE (a = 5)"

and not

{delete,project,{where, {a,'=',5}}} ->
  "DELETE FROM project WHERE (a = 5)"

making it consistent with

{select,{foo,as,bar},{from,{baz,as,blub}}} ->
  "SELECT foo AS bar FROM baz AS blub"

Also, it also feels it's just sql with some {} added here and there...
I mean that is I have to know the exact syntax of the sql statement,
then I can just as well compose it directly. Building sql statements
should be done only from the db layer, so regular application
developers will be insulated from it anyway.

That said, I think it's a good start and it opens interesting possibilities.
best regards,
Vlad



More information about the erlang-questions mailing list