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

Allow returning to be used with oracle update #1253

Merged
merged 1 commit into from Mar 8, 2016

Conversation

Projects
None yet
3 participants
@AiNoKame
Contributor

AiNoKame commented Mar 7, 2016

var returning = this.single.returning;
if (!returning) {
return 'update ' + this.tableName + ' set ' + updates.join(', ') + (where ? ' ' + where : '');

This comment has been minimized.

@wubzz

wubzz Mar 7, 2016

Collaborator

@AiNoKame Would you mind declaring this as a seperate variable sql and using said variable here and in the call to _addReturningToSqlAndConvert ?

Not too fond of using the same string concatenation more than once in a function. Also would make this easier to read.

This comment has been minimized.

@AiNoKame

AiNoKame Mar 7, 2016

Contributor

Sure thing!

This comment has been minimized.

@AiNoKame

AiNoKame Mar 7, 2016

Contributor

Amended 😄

This comment has been minimized.

@AiNoKame

AiNoKame Mar 7, 2016

Contributor

@wubzz Amended once more with line breaks in the sql statement to pass all the travis build tests

expect(bindings[0]).to.equal('foo');
expect(bindings[1]).to.equal('bar');
expect(bindings[2]).to.equal(1);
expect(bindings[3].toString()).to.equal('[object ReturningHelper:*]');

This comment has been minimized.

@rhys-vdw

rhys-vdw Mar 7, 2016

Collaborator

What's going on here? Not all that familiar with Oracle SQL.

This comment has been minimized.

@AiNoKame

AiNoKame Mar 8, 2016

Contributor

Oh, I should get rid of that comment on 2245. The bindings for returning ROWID into ? should link to the OutParam obj used returningSql helper (following the pattern for the insert method returning tests https://github.com/tgriesser/knex/blob/master/test/unit/query/builder.js#L2329)

This comment has been minimized.

@AiNoKame

AiNoKame Mar 8, 2016

Contributor

Basically, the update normally just returns the ROWID, and the returningSql helper uses that ROWID in a select query/subquery directly after the update

@rhys-vdw

This comment has been minimized.

Collaborator

rhys-vdw commented Mar 7, 2016

Could you please update the docs to show that returning is supported by Oracle also?

@AiNoKame

This comment has been minimized.

Contributor

AiNoKame commented Mar 8, 2016

@wubzz Absolutely! I updated the index.html

wubzz added a commit that referenced this pull request Mar 8, 2016

Merge pull request #1253 from AiNoKame/feature/oracle-update-returning
Allow returning to be used with oracle update

@wubzz wubzz merged commit 7b2c46f into tgriesser:master Mar 8, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment