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

Returns last id on multiple insertion #4176

Closed
ghost opened this issue May 21, 2019 · 4 comments
Closed

Returns last id on multiple insertion #4176

ghost opened this issue May 21, 2019 · 4 comments

Comments

@ghost
Copy link

ghost commented May 21, 2019

Issue type:

[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

Just try to insert multiple values at a time with any of queryBuilder or repository.

Got result something like below:

InsertResult {
  identifiers:
   [ { id: 67 },
     { id: 67 },
     { id: 67 },
     { id: 67 },
     { id: 67 },
     { id: 67 } ],
  generatedMaps:
   [ { id: 67 },
     { id: 67 },
     { id: 67 },
     { id: 67 },
     { id: 67 },
     { id: 67 } ],
  raw:
   OkPacket {
     fieldCount: 0,
     affectedRows: 6,
     insertId: 67,
     serverStatus: 2,
     warningCount: 0,
     message: '&Records: 6  Duplicates: 0  Warnings: 0',
     protocol41: true,
     changedRows: 0 } }

As you can see I got last inserted id.

@ghost
Copy link
Author

ghost commented Jun 3, 2019

Hey guys,
any solutions or references?

@Kononnable
Copy link
Contributor

Ahh, you didn't put any reproduction code, so I can only assume that your results are correct.
I think there was a similar issue here ... somewhere ...

Please add some code on which we could reproduce the issue.

@vlapo
Copy link
Contributor

vlapo commented Jun 4, 2019

Same as #2131 ?

@ghost
Copy link
Author

ghost commented Jun 5, 2019

Same as #2131 ?

@vlapo and @Kononnable Thanks for replying guys.

Yeah it looks same!

@ghost ghost closed this as completed Jun 5, 2019
This issue was closed.
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

No branches or pull requests

2 participants