Toxic Elephant

Don't bury it in your back yard!

A DSL for making SQL-like DSLs

Posted by matijs 14/04/2007 at 14h42

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.

Tags no comments no trackbacks

Who told you to come to this book store?

Posted by matijs 10/04/2007 at 22h22

Say you’re an online book store, and you have an affiliate program. Of course, affiliates come and go. So, what do you do when, say, slashdot stops being your affiliate, and someone clicks on an affiliate link left lying around in an old book review? Do you

  1. Show the book anyway, but not pay the affiliate? Or…
  2. Tell a potential customer to go elsewhere?

Hmm.

Tags 1 comment no trackbacks