I'm trying to run a simple query with node-mysql like this:
client.query("UPDATE mytable SET emote='wtf?' WHERE id=5");
And I get the error
Error: too few parameters given
Because it found a question mark and expects parameters. How the heck do I tell it to ignore the question mark!? Escaping it with
\ doesn't work. Passing
['?'] as a parameter is completely out of the question - what if I don't know the amount of question marks the query contains?
Currently I'm using a workaround that counts the amount of question marks in the query and passes that amount of question marks as parameters. But what if I were to actually need the parameters for what they were meant to do? I shiver at the thought.
So to summarize - How do I tell
client.query() to ignore question marks?
it's an unsolved bug: #118: Client.prototype.format shouldn't treat "?" as placeholder inside string literals
This recipe can be found in it's original form on Stack Over Flow.