avoid extra sql binding in unqualified search

This commit is contained in:
Damien Elmes 2020-03-20 09:26:49 +10:00
parent 1f9e8e388a
commit b70668d31c

View file

@ -88,13 +88,13 @@ impl SqlWriter<'_, '_> {
fn write_unqualified(&mut self, text: &str) { fn write_unqualified(&mut self, text: &str) {
// implicitly wrap in % // implicitly wrap in %
let text = format!("%{}%", text); let text = format!("%{}%", text);
self.args.push(text.into());
write!( write!(
self.sql, self.sql,
"(n.sfld like ? escape '\\' or n.flds like ? escape '\\')" "(n.sfld like ?{n} escape '\\' or n.flds like ?{n} escape '\\')",
n = self.args.len(),
) )
.unwrap(); .unwrap();
self.args.push(text.clone().into());
self.args.push(text.into());
} }
fn write_tag(&mut self, text: &str) { fn write_tag(&mut self, text: &str) {