Archive for the ‘sql’ Category.

I just don't get it. (An "I ♥ SQL" rant)

What's so bad about liking SQL? About enjoying the beauty of a really damned well-written and concise query? Seriously, I just don't get the hype about ORMs versus writing the queries yourself.

Don't give me the "but it makes everything portable!" argument. How many times have you designed something, only to have to switch to a different RBDMS partway through? Or had to switch to a new one after the project's done? *snort* Yeah, that's what I thought. If you're that worried about this elusive and inchoate thing called "portability," design the system so all the queries can be put in one directory or file, and provide a way to swap out the optimized queries for each database-specific version. You know, kinda like we already provide language translations.

Please explain to me how a system that takes hours (eight and counting) to debug and runs a separate query for each fucking result is superior to the single optimized query I can write in less than thirty seconds and which produces the exact results that I need and no more, with none of the tearing out of hair and hours of frustration?

Also, if you're going to write a framework that alleges that the ORM can be easily decoupled from the framework so that you can write your own SQL? An easy and—most importantly—well-documented way to get the damned results into the format the rest of the framework expects would be really nice. (The crap that makes up 99% of all documentation for programs—open source or commercial—is a rant for another day.)