Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: operator.update, columns in where cant be updated #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix: operator.update, columns in where cant be updated #27

wants to merge 1 commit into from

Conversation

sunfuze
Copy link

@sunfuze sunfuze commented Jul 18, 2017

@mention-bot
Copy link

@sunfuze, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fengmk2, @dead-horse and @csbun to be potential reviewers.

lib/operator.js Outdated
@@ -154,15 +154,13 @@ proto.update = function* (table, row, options) {
options.where = {
id: row.id,
};
[].splice.call(options.columns, options.columns.indexOf('id'), 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段代码好奇怪。。。

请加上测试用例辅助说明问题

@codecov-io
Copy link

codecov-io commented Jul 18, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@7cb4e75). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #27   +/-   ##
=========================================
  Coverage          ?   98.92%           
=========================================
  Files             ?        6           
  Lines             ?      278           
  Branches          ?       40           
=========================================
  Hits              ?      275           
  Misses            ?        3           
  Partials          ?        0
Impacted Files Coverage Δ
lib/operator.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7cb4e75...089fa9b. Read the comment docs.

@sunfuze
Copy link
Author

sunfuze commented Jul 18, 2017

db.update('table', { field1: 'abc', field2: 'efg' }, {
  where: { field1: 'a', id: 1 }
})`

原来上面这种情况,是不会更新 field1的。


db.update('table', { id: 1, field1: 'abc' })

上面的代码生成的 sql 不应该有 'SET id = 1' 的内容。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants