I'd love to access a database using code like:
(select column-list selector-expression)
(with table selector-expression)
(group column-list query grouping-expression)
(order query order-list)
(join query-list join-expression)
erlsql[0] attempts to add this type of syntax to Erlang, but does so
in a hatefully inconsistent way. Maybe it's
{select,[random,'()','*',count],
{from,bar},
{where,{id,'=',5}}}
or maybe it's
{select,[{{call,random,[]},'*',count}],
from,{bar},
where,[{id,'=',5}]}
Depends on the query. Where does "order by" go? Maybe it works, maybe
it doesn't.
Does it work with expressions in the "order by" clause? Nope.
Bonus hate: yay for "documentation" that exists only as a blog entry[1]!
Bonus bonus hate: yay for totally (and badly) re-inventing prepared
statements and DBMS abstraction[2][3] instead of using the system
*built for that* that ships with the language, introducing a whole
slew of data- and database-dependent bugs[4]!
[0]
http://yarivsblog.com/articles/2006/09/16/introducing-erlsql-easy-expression-and-generation-of-sql-statements-in-erlang/
[1] http://erlyweb.org/doc/erlsql.html is the official documentation.
It's basically empty.
[2] http://erlyweb.org/doc/erlydb_mysql.html
[3] http://erlyweb.org/doc/erlydb_psql.html
[4] http://forum.trapexit.org/mailinglists/viewtopic.php?t=11358