Hacker News new | ask | show | jobs
by failed_ideas 4143 days ago
I wouldn't call that better. I'd much rather have a self escaping sql literal, something like:

    var query = "select id, name from table where id = #{id:int}"
2 comments

Agreed, the value of magic fades very quickly when you're trying to to retro-implement complex SQL query from Stackoverflow into "smart query" language.
That won't use a parametrised query, though.
Why not, I'm talking about a construct that doesn't exist. A SQL literal string can be stored and auto parameterized prior to interpolation. You see the :int isn't the name, it's the parameter/type safeyness that any good dev would want.