Skip to content

Use unique param for affectedRows #203

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

Merged
merged 1 commit into from
Jan 24, 2017
Merged

Use unique param for affectedRows #203

merged 1 commit into from
Jan 24, 2017

Conversation

loay
Copy link
Contributor

@loay loay commented Jan 19, 2017

connect to #204

@loay
Copy link
Contributor Author

loay commented Jan 20, 2017

@bajtos PTAL. Thanks

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

Nice!

Could you please add a unit-test to verify this change. Perhaps these tests should be implemented in the shared test suite in loopback-datasource-juggler?

@@ -153,7 +153,7 @@ PostgreSQL.prototype.executeSQL = function(sql, params, options, callback) {
switch (data.command) {
case 'DELETE':
case 'UPDATE':
result = {count: data.rowCount};
result = {affectedRows: data.rowCount};
Copy link
Member

Choose a reason for hiding this comment

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

Please preserve the count property for backwards compatibility.

result = {affectedRows: data.rowCount, count: data.rowCount};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done and unit test added

@bajtos
Copy link
Member

bajtos commented Jan 20, 2017

Let's leave the tests out of scope of this patch, since they have to be implemented in a different repository anyways. However, I think it makes sense to add a postgresql-specific test to verify that the count property is preserved.

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

Two details to fix, the rest LGTM. Please squash the comments before landing.

@@ -90,6 +90,21 @@ describe('postgresql connector', function() {
});
});

it('should reserve property `count` after query execution', function(done) {
Copy link
Member

Choose a reason for hiding this comment

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

preserve

Post.create(
{title: 'T10', content: 'C10'},
function(err, p) {
should.not.exists(err);
Copy link
Member

Choose a reason for hiding this comment

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

if (err) return done(err);

@loay loay merged commit 9b49fc9 into master Jan 24, 2017
@loay loay removed the review label Jan 24, 2017
@loay loay deleted the affectedRows branch January 24, 2017 15:43
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.

2 participants