mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
feat(server): log ignored DB changes in wrapper
This commit is contained in:
parent
6f5304467a
commit
bd0cb91171
@ -210,6 +210,13 @@ function getColumn<T>(query: string, params: Params = []): T[] {
|
||||
}
|
||||
|
||||
function execute(query: string, params: Params = []): RunResult {
|
||||
if (config.General.readOnly && (query.startsWith("UPDATE") || query.startsWith("INSERT") || query.startsWith("DELETE"))) {
|
||||
log.error(`read-only DB ignored: ${query} with parameters ${JSON.stringify(params)}`);
|
||||
return {
|
||||
changes: 0,
|
||||
lastInsertRowid: 0
|
||||
};
|
||||
}
|
||||
return wrap(query, (s) => s.run(params)) as RunResult;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user