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

Allow returning to be used with oracle update #1253

Merged
merged 1 commit into from Mar 8, 2016

Conversation

@AiNoKame
Copy link
Contributor

@AiNoKame 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
Member

@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
Author Contributor

Sure thing!

This comment has been minimized.

@AiNoKame

AiNoKame Mar 7, 2016
Author Contributor

Amended 😄

This comment has been minimized.

@AiNoKame

AiNoKame Mar 7, 2016
Author Contributor

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

@AiNoKame AiNoKame force-pushed the AiNoKame:feature/oracle-update-returning branch 4 times, most recently from 56d45cf to 86263b3 Mar 7, 2016
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
Member

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

This comment has been minimized.

@AiNoKame

AiNoKame Mar 8, 2016
Author 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
Author 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
Copy link
Member

@rhys-vdw rhys-vdw commented Mar 7, 2016

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

@AiNoKame AiNoKame force-pushed the AiNoKame:feature/oracle-update-returning branch from 86263b3 to ab003ac Mar 8, 2016
@AiNoKame
Copy link
Contributor Author

@AiNoKame AiNoKame commented Mar 8, 2016

@wubzz Absolutely! I updated the index.html

wubzz added a commit that referenced this pull request Mar 8, 2016
Allow returning to be used with oracle update
@wubzz wubzz merged commit 7b2c46f into knex:master Mar 8, 2016
1 check passed
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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants