A DSL for making SQL-like DSLs
Posted by matijs
Setting the stage
Some time ago, I came across SQLDSL, a DSL for building SQL queries. The benefit of using a DSL over plain old string concatenation is that syntax is checked before the database server is hit. Unfortunately, SQLDSL does not deliver. It will happily accept
q = Insert.into["frot"]["zop"]["blob"].values("kng").values["kgn"]resulting in
q.to_sql
# => "insert into 'frot' (zop) (blob) values ('kng') values () (kgn)"which is hardly acceptable SQL.
Read more...