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

Yariv Sadan yarivvv@REDACTED
Sun Sep 17 22:39:23 CEST 2006


Hi,

> 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"
>

I made it so now you can write {delete, {from, project}, {where,
{a,'=',5}}}, and also {update, project, {a,'=',5}, {where, {b,'=',7}}}

The 'from' and 'where' components are optional because they are
implicit in the structure of DELETE and UPDATE statements, but not in
the structure of SELECT statements.

Regards,
Yariv



More information about the erlang-questions mailing list