-
Notifications
You must be signed in to change notification settings - Fork 181
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
Conversation
@bajtos PTAL. Thanks |
There was a problem hiding this 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}; |
There was a problem hiding this comment.
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};
There was a problem hiding this comment.
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
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 |
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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);
connect to #204