mirror of
https://github.com/edu4rdshl/Strata.git
synced 2026-07-18 07:34:45 +00:00
perf: don't load thumbnail_blob in get_raw_item
get_raw_item is used by GetItemContent (paste-back) and SetClipboard. Neither caller needs the thumbnail -- they only need the original payload. Excluding thumbnail_blob from the SELECT avoids loading up to ~40 KB of PNG data per paste operation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
e2f7aa7a7c
commit
87e7e9f774
1 changed files with 6 additions and 5 deletions
|
|
@ -263,11 +263,12 @@ impl Db {
|
||||||
Ok(blob.flatten())
|
Ok(blob.flatten())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch raw item content for clipboard write-back.
|
/// Fetch raw item content for clipboard write-back. Does not load
|
||||||
|
/// thumbnail_blob -- callers only need the original payload.
|
||||||
pub fn get_raw_item(&self, id: &str) -> Result<Option<RawItem>> {
|
pub fn get_raw_item(&self, id: &str) -> Result<Option<RawItem>> {
|
||||||
let conn = lock_conn(&self.conn);
|
let conn = lock_conn(&self.conn);
|
||||||
let result = conn.query_row(
|
let result = conn.query_row(
|
||||||
"SELECT id, mime_type, content_text, content_blob, thumbnail_blob, source_app, created_at
|
"SELECT id, mime_type, content_text, content_blob, source_app, created_at
|
||||||
FROM clipboard_history WHERE id = ?1",
|
FROM clipboard_history WHERE id = ?1",
|
||||||
params![id],
|
params![id],
|
||||||
|row| {
|
|row| {
|
||||||
|
|
@ -276,9 +277,9 @@ impl Db {
|
||||||
mime_type: row.get(1)?,
|
mime_type: row.get(1)?,
|
||||||
content_text: row.get(2)?,
|
content_text: row.get(2)?,
|
||||||
content_blob: row.get(3)?,
|
content_blob: row.get(3)?,
|
||||||
thumbnail_blob: row.get(4)?,
|
thumbnail_blob: None,
|
||||||
source_app: row.get(5)?,
|
source_app: row.get(4)?,
|
||||||
created_at: row.get(6)?,
|
created_at: row.get(5)?,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
).ok();
|
).ok();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue