From aee3502659d79b7f183a0df09d369a038d824cf4 Mon Sep 17 00:00:00 2001
From: Richard Soderberg <rsoderberg@gmail.com>
Date: Tue, 3 Apr 2012 23:53:46 -0700
Subject: [PATCH] use VALUES(col) instead of passing the col value twice, per
 5.0+ syntax

---
 lib/db/mysql.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/db/mysql.js b/lib/db/mysql.js
index 19a6aa4ff..b984dcbf4 100644
--- a/lib/db/mysql.js
+++ b/lib/db/mysql.js
@@ -244,8 +244,8 @@ exports.stageUser = function(email, cb) {
   secrets.generate(48, function(secret) {
     // overwrite previously staged users
     client.query('INSERT INTO staged (secret, new_acct, email) VALUES(?,TRUE,?) ' +
-                 'ON DUPLICATE KEY UPDATE secret=?, existing_user=NULL, new_acct=TRUE, ts=NOW()',
-                 [ secret, email, secret],
+                 'ON DUPLICATE KEY UPDATE secret=VALUES(secret), existing_user=NULL, new_acct=TRUE, ts=NOW()',
+                 [ secret, email ],
                  function(err) {
                    cb(err, err ? undefined : secret);
                  });
@@ -424,8 +424,8 @@ exports.stageEmail = function(existing_user, new_email, cb) {
   secrets.generate(48, function(secret) {
     // overwrite previously staged users
     client.query('INSERT INTO staged (secret, new_acct, existing_user, email) VALUES(?,FALSE,?,?) ' +
-                 'ON DUPLICATE KEY UPDATE secret=?, existing_user=?, new_acct=FALSE, ts=NOW()',
-                 [ secret, existing_user, new_email, secret, existing_user],
+                 'ON DUPLICATE KEY UPDATE secret=VALUES(secret), existing_user=VALUES(existing_user), new_acct=FALSE, ts=NOW()',
+                 [ secret, existing_user, new_email ],
                  function(err) {
                    cb(err, err ? undefined : secret);
                  });
-- 
GitLab