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

Mobile: Resolves #285: Create, edit and remove tags from notes

This commit is contained in:
Laurent Cozic
2018-03-16 20:17:52 +00:00
parent 544f93bf22
commit aabb9be7de
9 changed files with 270 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ class Database {
this.driver_ = driver;
this.logger_ = new Logger();
this.logExcludedQueryTypes_ = [];
this.batchTransactionMutex_ = new Mutex();
}
setLogExcludedQueryTypes(v) {
@@ -113,16 +114,20 @@ class Database {
}
// There can be only one transaction running at a time so use a mutex
const release = await Database.batchTransactionMutex_.acquire();
const release = await this.batchTransactionMutex_.acquire();
try {
queries.splice(0, 0, 'BEGIN TRANSACTION');
queries.push('COMMIT'); // Note: ROLLBACK is currently not supported
await this.exec('BEGIN TRANSACTION');
for (let i = 0; i < queries.length; i++) {
let query = this.wrapQuery(queries[i]);
await this.exec(query.sql, query.params);
}
await this.exec('COMMIT');
} catch (error) {
await this.exec('ROLLBACK');
throw error;
} finally {
release();
}
@@ -300,8 +305,6 @@ class Database {
}
Database.batchTransactionMutex_ = new Mutex();
Database.TYPE_UNKNOWN = 0;
Database.TYPE_INT = 1;
Database.TYPE_TEXT = 2;