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

feat: UpdateResult returns affected rows in mysql #5628

Merged
merged 1 commit into from Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/query-builder/UpdateQueryBuilder.ts
Expand Up @@ -104,6 +104,10 @@ export class UpdateQueryBuilder<Entity> extends QueryBuilder<Entity> implements
updateResult.raw = result[0];
updateResult.affected = result[1];
}
else if (this.connection.driver instanceof MysqlDriver) {
updateResult.raw = result;
updateResult.affected = result.affectedRows;
}
else {
updateResult.raw = result;
}
Expand Down
2 changes: 1 addition & 1 deletion test/github-issues/1308/issue-1308.ts
Expand Up @@ -11,7 +11,7 @@ describe("github issues > #1308 Raw Postgresql Update query result is always an
(connections = await createTestingConnections({
entities: [new EntitySchema<Author>(AuthorSchema), new EntitySchema<Post>(PostSchema)],
dropSchema: true,
enabledDrivers: ["postgres"],
enabledDrivers: ["postgres", "mysql", "mariadb"],
}))
);
beforeEach(() => reloadTestingDatabases(connections));
Expand Down