1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Desktop: Resolves #206: Added support for sorting notebooks by title or last modified

This commit is contained in:
Laurent Cozic
2019-03-02 17:35:57 +00:00
parent 2256b0c5ec
commit 833d473268
8 changed files with 204 additions and 25 deletions

View File

@@ -100,6 +100,17 @@ class Database {
return this.tryCall('selectAll', sql, params);
}
async selectAllFields(sql, params, field) {
const rows = await this.tryCall('selectAll', sql, params);
const output = [];
for (let i = 0; i < rows.length; i++) {
const v = rows[i][field];
if (!v) throw new Error('No such field: ' + field + '. Query was: ' + sql);
output.push(rows[i][field]);
}
return output;
}
async exec(sql, params = null) {
return this.tryCall('exec', sql, params);
}