4 ms·
> a nice API for building queries (that actually supports all underlying database features) Honestly asking - I'm not an expert in this space: is this not just
by jkaptur 4y ago
> a nice API for building queries (that actually supports all underlying database features)
Honestly asking - I'm not an expert in this space: is this not just parameterized queries?
It seems like anything else would have to have exactly the same "shape" in order to support all underlying database features...
- mbreese 4y agoThe only part of ORMs I liked was the ability to dynamically build queries. You’re right that a query would have to return the same columns (for common downstream processing), but a query builder can make adding conditions much easier. For example, if you’re adding filtering to a product list. The query will always return the product id, name, image url and description. But you might have multiple filters (in stock, blue, etc). The query builder can make that process easier and less error prone. Same with pagination, depending on how you do it.
- vlunkr 4y agoA query builder is much more flexible. For example, in some cases there might be an additional condition you want to add to the WHERE clause. You can't do that with parameterized queries, so you'd have to make a new query for every possible variation. That may be fine in some cases, but it could become a maintenance headache in large project.