5 ms·
I don't get why some people keep praising SQL like this. SQL is great for complex queries that contain valuable logic, but it's not expressive at all when you w
by wlievens 17y ago
I don't get why some people keep praising SQL like this. SQL is great for complex queries that contain valuable logic, but it's not expressive at all when you want to do something trivial. Getting all the attributes of user X is so much more work, and harder to maintain, in SQL than it is in any ORM.
"select name, pass, hash, email, realname from user where id = ?"
versus
session.get("User", x)
- jrockway 17y agoSQL is not particularly nice for complex queries, either. The underlying model is good, but the particular syntax they chose is verbose, confusing, and non-portable.
- wlievens 17y agoI kind of agree, but I was conceding the most reasonable argument to the parent.
- james2vegas 17y ago'SELECT * FROM user WHERE id = ?' OR 'SELECT getUser(?)' presuming you have a stored procedure/function getUser that returns the data you need, and you should (or a view, at least)
- mattmanser 17y agoSELECT *? A function in the SELECT statment? Oh dear god, a blasphemer! The former can cause performance problems if you have blobs as well as being an unnecessary security hole, the latter can cause performance problems over large datasets as it often forces the execution plan away from a set based solution.
- wlievens 17y agoThe fact that using the most trivial of examples triggers a discussion in on itself helps to prove my point. Nobody debates session.getUser(id)