Closed cuyler closed 3 weeks ago
What do you mean by "quoted strings"? Query parameters are not inlined into the query, they're sent separately. I would expect something like this to work just fine:
let rows = client.query("SELECT name FROM foo WHERE name LIKE $1", &[&"Foo%"]);`
and would return values like Foobar
.
Aye; Thanks for the rubber ducking and apologies for the time waster. I didn't think to check the input, which WAS quoted. Doh.
This is probably a silly question but for the life of me, I can't see it. How does one execute statements with LIKE as part of the query? Postgresql sees a difference between '"Foo"%' (or '"Foo%"') and 'Foo%' in the context of LIKE. It's understandable to use quoted strings for sql injection prevention, however it's unclear how to use a LIKE statement with those parameters... Is there an alternative canonical way to accomplish this with tokio_postgres?