Re:For Want of a JOIN
by fifilura on Thursday December 22, 2022 @12:53PM
(#34096208)
To be fair, there is one important thing the ORM brings though. Sanatizing inputs.
[ Parent
| on HN ]
Don't sanitize your inputs; parameterize your queries instead.
I see those as two different solutions to two different, but slightly overlapping problems.
Re:For Want of a JOIN
by pessimizer on Thursday December 22, 2022 @03:47PM
(#34098451)
Going to keep those problems a secret?
Re:For Want of a JOIN
by Lvl999Noob on Friday December 23, 2022 @07:06AM
(#34104894)
Imo, the problems are the same but the conditions are different. If the query is used many times, parameterize it. If the input is used many times, sanitize it. If both are used many times, parameterize.
Parameterising works for individual fields in a statement. However for complex queries (the reason for the meta-programmimg comment) you can’t always parameterise the additional subqueries/tables/fields. You can use stored procedures, but that just shifts the necessary code from one language to SQL, and the SQL doesn’t have a robust library you can just use.