mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
converted most dynamic SQL queries into prepared statement to avoid excessive statement caching
This commit is contained in:
@@ -33,10 +33,12 @@ function getAutocomplete(req) {
|
||||
|
||||
function getRecentNotes(activeNoteId) {
|
||||
let extraCondition = '';
|
||||
const params = [activeNoteId];
|
||||
|
||||
const hoistedNoteId = optionService.getOption('hoistedNoteId');
|
||||
if (hoistedNoteId !== 'root') {
|
||||
extraCondition = `AND recent_notes.notePath LIKE '%${utils.sanitizeSql(hoistedNoteId)}%'`;
|
||||
extraCondition = `AND recent_notes.notePath LIKE ?`;
|
||||
params.push(hoistedNoteId + '%');
|
||||
}
|
||||
|
||||
const recentNotes = repository.getEntities(`
|
||||
@@ -52,7 +54,7 @@ function getRecentNotes(activeNoteId) {
|
||||
${extraCondition}
|
||||
ORDER BY
|
||||
utcDateCreated DESC
|
||||
LIMIT 200`, [activeNoteId]);
|
||||
LIMIT 200`, params);
|
||||
|
||||
return recentNotes.map(rn => {
|
||||
const title = noteCacheService.getNoteTitleForPath(rn.notePath.split('/'));
|
||||
|
||||
Reference in New Issue
Block a user