mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
Avoid excessive allocation in dc_search_msgs
This commit is contained in:
@@ -506,12 +506,12 @@ pub fn dc_search_msgs(
|
|||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
|
|
||||||
let real_query = to_string(query).trim().to_string();
|
let real_query = as_str(query).trim();
|
||||||
if real_query.is_empty() {
|
if real_query.is_empty() {
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
}
|
}
|
||||||
let strLikeInText = format!("%{}%", &real_query);
|
let strLikeInText = format!("%{}%", real_query);
|
||||||
let strLikeBeg = format!("{}%", &real_query);
|
let strLikeBeg = format!("{}%", real_query);
|
||||||
|
|
||||||
let query = if 0 != chat_id {
|
let query = if 0 != chat_id {
|
||||||
"SELECT m.id, m.timestamp FROM msgs m LEFT JOIN contacts ct ON m.from_id=ct.id WHERE m.chat_id=? \
|
"SELECT m.id, m.timestamp FROM msgs m LEFT JOIN contacts ct ON m.from_id=ct.id WHERE m.chat_id=? \
|
||||||
|
|||||||
Reference in New Issue
Block a user