1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

All: Allow disabling encryption and added more test cases

This commit is contained in:
Laurent Cozic
2017-12-20 20:45:25 +01:00
parent cc02c1d585
commit 18846c11ed
9 changed files with 281 additions and 68 deletions

View File

@ -96,8 +96,11 @@ class BaseModel {
return options;
}
static count() {
return this.db().selectOne('SELECT count(*) as total FROM `' + this.tableName() + '`').then((r) => {
static count(options = null) {
if (!options) options = {};
let sql = 'SELECT count(*) as total FROM `' + this.tableName() + '`';
if (options.where) sql += ' WHERE ' + options.where;
return this.db().selectOne(sql).then((r) => {
return r ? r['total'] : 0;
});
}