Skip to content

Commit

Permalink
fix: query parameters are not allowed to be included in where (ali-sd…
Browse files Browse the repository at this point in the history
  • Loading branch information
hoythan authored and dead-horse committed Apr 24, 2019
1 parent cbb8503 commit 52147de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 0 additions & 3 deletions lib/operator.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ proto.update = function* (table, row, options) {
const values = [];
for (let i = 0; i < options.columns.length; i++) {
const column = options.columns[i];
if (column in options.where) {
continue;
}
sets.push('?? = ?');
values.push(column);
values.push(row[column]);
Expand Down
12 changes: 11 additions & 1 deletion test/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,20 @@ describe('async.test.js', function() {
});
assert.equal(result.affectedRows, 1);

result = await this.db.update(table, {
email: prefix + 'm@fengmk2-update3.com',
}, {
where: {
name: prefix + 'fengmk2-update',
email: prefix + 'm@fengmk2-update2.com',
},
});
assert.equal(result.affectedRows, 1);

user = await this.db.get(table, {
name: prefix + 'fengmk2-update',
});
assert.deepEqual(user.email, prefix + 'm@fengmk2-update2.com');
assert.deepEqual(user.email, prefix + 'm@fengmk2-update3.com');
assert.deepEqual(new Date(user.gmt_create), new Date('2000'));
assert(user.gmt_modified instanceof Date);

Expand Down

0 comments on commit 52147de

Please sign in to comment.