DEBUG: verbose sqlite

This commit is contained in:
Reto Brunner 2022-11-01 23:21:03 +01:00
parent 8b1a4f72fa
commit 884edcc301

View file

@ -74,6 +74,7 @@ class SqliteMessageStorage implements ISqliteMessageStorage {
this.isEnabled = true;
this.database = new sqlite3.Database(sqlitePath);
this.database.on("trace", (sql) => log.debug(`sql-${this.stmt_id()} ${sql}`));
try {
await this.run_migrations();
@ -274,6 +275,11 @@ class SqliteMessageStorage implements ISqliteMessageStorage {
return this.isEnabled;
}
private _stmt_id = 0;
private stmt_id(): string {
return (this._stmt_id++).toString();
}
private serialize_run(stmt: string, params: any[]): Promise<void> {
return new Promise((resolve, reject) => {
this.database.serialize(() => {