diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2021-03-27 00:12:29 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2021-03-27 00:12:29 +0300 |
commit | 07ad8de77e16c00831db3687c1a8e67bbd062972 (patch) | |
tree | 6df1d75b162a89d5e225d90242eac2ca9f4f6833 /src | |
parent | fa133e4455233fbf9c4e278eb88e2ce4e92c668d (diff) |
fix mysql bug
Diffstat (limited to 'src')
-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) } /** |