converted most dynamic SQL queries into prepared statement to avoid excessive statement caching

This commit is contained in:
zadam
2020-06-20 23:24:34 +02:00
parent 969f31dde2
commit 5f699cc28c
6 changed files with 13 additions and 20 deletions

View File

@@ -31,8 +31,6 @@ function periodBackup(optionName, fileName, periodInSeconds) {
}
}
const COPY_ATTEMPT_COUNT = 50;
async function copyFile(backupFile) {
const sql = require('./sql');
@@ -78,7 +76,7 @@ async function anonymize() {
// on the other hand builtin/system attrs should not contain any sensitive info
const builtinAttrs = attributeService
.getBuiltinAttributeNames()
.map(name => "'" + utils.sanitizeSql(name) + "'").join(', ');
.map(name => "'" + name + "'").join(', ');
db.prepare(`UPDATE attributes SET name = 'name', value = 'value' WHERE type = 'label' AND name NOT IN(${builtinAttrs})`).run();
db.prepare(`UPDATE attributes SET name = 'name' WHERE type = 'relation' AND name NOT IN (${builtinAttrs})`).run();