News for hackers. Stuff that matters.
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.
Re:For Want of a JOIN by zanecodes on Thursday December 22, 2022 @01:02PM (#34096327)
Don't sanitize your inputs; parameterize your queries instead.
Re:For Want of a JOIN by Tostino on Thursday December 22, 2022 @01:26PM (#34096628)
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.
Re:For Want of a JOIN by robocat on Thursday December 22, 2022 @05:37PM (#34099844)
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.