Skip to content

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

Open
sunfuze wants to merge 1 commit into
ali-sdk:masterfrom
sunfuze:fix/operator_update
Open

fix: operator.update, columns in where cant be updated#27
sunfuze wants to merge 1 commit into
ali-sdk:masterfrom
sunfuze:fix/operator_update

Conversation

@sunfuze

@sunfuze sunfuze commented Jul 18, 2017

Copy link
Copy Markdown

@mention-bot

Copy link
Copy Markdown

@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.

Comment thread lib/operator.js Outdated
options.where = {
id: row.id,
};
[].splice.call(options.columns, options.columns.indexOf('id'), 1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这段代码好奇怪。。。

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

@codecov-io

codecov-io commented Jul 18, 2017

Copy link
Copy Markdown

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

sunfuze commented Jul 18, 2017

Copy link
Copy Markdown
Author
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.

4 participants