diff options
-rw-r--r-- | src/lib/worker.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/worker.js b/src/lib/worker.js index 0be6a19..cd1f0cd 100644 --- a/src/lib/worker.js +++ b/src/lib/worker.js @@ -547,14 +547,17 @@ class Worker extends EventEmitter { update.stdout = data.stdout let list = [] + let argv = [] + for (let field in update) { let val = update[field] - if (val !== null) - val = db.escape(val) - list.push(`${field}=${val}`) + list.push(`${field}=?`) + argv.push(val) } - await db.query(`UPDATE ${config.get('mysql_table')} SET ${list.join(', ')} WHERE id=?`, [id]) + argv.push(id) + + await db.query(`UPDATE ${config.get('mysql_table')} SET ${list.join(', ')} WHERE id=?`, argv) } /** |