Toxic Elephant

A DSL for making SQL-like DSLs

Posted by matijs Sat, 14 Apr 2007 14:42:00 GMT

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

Posted in  | Tags , , ,  | no comments | no trackbacks

Toxic Elephant is Matijs van Zuijlen's weblog.

Powered

Categories

Archives