mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
change in naming of SQL methods
added assert methods to note tree
This commit is contained in:
@@ -6,7 +6,7 @@ const notes = require('./notes');
|
||||
const sync_table = require('./sync_table');
|
||||
|
||||
async function updateNote(entity, sourceId) {
|
||||
const origNote = await sql.getSingleResult("SELECT * FROM notes WHERE note_id = ?", [entity.note_id]);
|
||||
const origNote = await sql.getFirst("SELECT * FROM notes WHERE note_id = ?", [entity.note_id]);
|
||||
|
||||
if (!origNote || origNote.date_modified <= entity.date_modified) {
|
||||
await sql.doInTransaction(async () => {
|
||||
@@ -21,7 +21,7 @@ async function updateNote(entity, sourceId) {
|
||||
}
|
||||
|
||||
async function updateNoteTree(entity, sourceId) {
|
||||
const orig = await sql.getSingleResultOrNull("SELECT * FROM notes_tree WHERE note_tree_id = ?", [entity.note_tree_id]);
|
||||
const orig = await sql.getFirstOrNull("SELECT * FROM notes_tree WHERE note_tree_id = ?", [entity.note_tree_id]);
|
||||
|
||||
await sql.doInTransaction(async () => {
|
||||
if (orig === null || orig.date_modified < entity.date_modified) {
|
||||
@@ -37,7 +37,7 @@ async function updateNoteTree(entity, sourceId) {
|
||||
}
|
||||
|
||||
async function updateNoteHistory(entity, sourceId) {
|
||||
const orig = await sql.getSingleResultOrNull("SELECT * FROM notes_history WHERE note_history_id = ?", [entity.note_history_id]);
|
||||
const orig = await sql.getFirstOrNull("SELECT * FROM notes_history WHERE note_history_id = ?", [entity.note_history_id]);
|
||||
|
||||
await sql.doInTransaction(async () => {
|
||||
if (orig === null || orig.date_modified_to < entity.date_modified_to) {
|
||||
@@ -65,7 +65,7 @@ async function updateOptions(entity, sourceId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const orig = await sql.getSingleResultOrNull("SELECT * FROM options WHERE opt_name = ?", [entity.opt_name]);
|
||||
const orig = await sql.getFirstOrNull("SELECT * FROM options WHERE opt_name = ?", [entity.opt_name]);
|
||||
|
||||
await sql.doInTransaction(async () => {
|
||||
if (orig === null || orig.date_modified < entity.date_modified) {
|
||||
@@ -79,7 +79,7 @@ async function updateOptions(entity, sourceId) {
|
||||
}
|
||||
|
||||
async function updateRecentNotes(entity, sourceId) {
|
||||
const orig = await sql.getSingleResultOrNull("SELECT * FROM recent_notes WHERE note_tree_id = ?", [entity.note_tree_id]);
|
||||
const orig = await sql.getFirstOrNull("SELECT * FROM recent_notes WHERE note_tree_id = ?", [entity.note_tree_id]);
|
||||
|
||||
if (orig === null || orig.date_accessed < entity.date_accessed) {
|
||||
await sql.doInTransaction(async () => {
|
||||
|
||||
Reference in New Issue
Block a user