- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Might be YodaSQL
Edit Admin
I like it. Twice as much WTF for my money today.
Admin
I presume jOOQ is an acceptable builder. I'm a fan.
Admin
Perhaps I'm missing something, so please educate me: how is using a SQL builder NOT "just concatenation with extra steps"? I mean, at the end of it all, it's just going to emit the query as a string, right?
Admin
It checks variable types and escapes/quotes properly.
Edit Admin
It's all about abstraction levels.
Edit Admin
I mean, yes, the final output is a string, so at some level, it's going to emit a string of characters, thus making anything "concatenation with extra steps". But, if you have a decent builder API, what it absolutely prohibits is constructing invalid statements: you construct the syntax tree as a data structure, manipulate it, and then only when it goes to the database, do you convert it to SQL. The canonical representation is the syntax, not the string, and it's an exception to construct anything but a valid statement.
Admin
Personally I've never understood the appeal of builders. What you end up is the same thing as SQL, except a lot more verbose with a lot more noise. Reading it is an order of magnitude harder than reading just a plain SQL query. Not to mention the fact that you'll usually have to give up all the special features your particular RDBMS might have and need to settle for lowest common denominator amongst all supported RDBMSes. Yes, concatenation is the other extreme, but why not just fixed SQL statements with parameters? That covers about 90% of your everyday needs.