Add get_note_without_fields() from storage

This commit is contained in:
RumovZ 2021-03-20 11:59:45 +01:00
parent f7e4b6d822
commit 1823c0dda4
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,10 @@
SELECT id,
guid,
mid,
mod,
usn,
tags,
"",
cast(sfld AS text),
csum
FROM notes

View file

@ -29,6 +29,17 @@ impl super::SqliteStorage {
.transpose()
}
pub fn get_note_without_fields(&self, nid: NoteID) -> Result<Option<Note>> {
self.db
.prepare_cached(concat!(
include_str!("get_without_fields.sql"),
" where id = ?"
))?
.query_and_then(params![nid], row_to_note)?
.next()
.transpose()
}
/// If fields have been modified, caller must call note.prepare_for_update() prior to calling this.
pub(crate) fn update_note(&self, note: &Note) -> Result<()> {
assert!(note.id.0 != 0);