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(core): add driver.nativeInsertMany() method #688

Merged
merged 1 commit into from Jul 28, 2020
Merged

feat(core): add driver.nativeInsertMany() method #688

merged 1 commit into from Jul 28, 2020

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Jul 28, 2020

This method can be used for bulk inserts. It works in all existing drivers,
but has some limitations in SQLite and MySQL/MariaDB. Those drivers do not
return all the just created PKs.

MySQL/MariaDB will return PK of the first entity in the batch. If we have
innodb_autoinc_lock_mode set to 0/1 it is possible to compute the following
PKs simply by incrementing the first PK value.
(see https://stackoverflow.com/a/16592867/3665878)

SQLite on the other hand will return only the last PK.

Postgres and MongoDB both return all the PKs in the res.rows array.

Related: #442

This method can be used for bulk inserts. It works in all existing drivers,
but has some limitations in SQLite and MySQL/MariaDB. Those drivers do not
return all the just created PKs.

MySQL/MariaDB will return PK of the first entity in the batch. If we have
`innodb_autoinc_lock_mode` set to 0/1 it is possible to compute the following
PKs simply by incrementing the first PK value.
(see https://stackoverflow.com/a/16592867/3665878)

SQLite on the other hand will return only the last PK.

Postgres and MongoDB both return all the PKs in the `res.rows` array.

Related: #442
@B4nan B4nan merged commit 60f0d02 into dev Jul 28, 2020
@B4nan B4nan deleted the bulk-insert branch July 28, 2020 17:02
@B4nan B4nan mentioned this pull request Jul 28, 2020
46 tasks
B4nan added a commit that referenced this pull request Aug 2, 2020
This method can be used for bulk inserts. It works in all existing drivers,
but has some limitations in SQLite and MySQL/MariaDB. Those drivers do not
return all the just created PKs.

MySQL/MariaDB will return PK of the first entity in the batch. If we have
`innodb_autoinc_lock_mode` set to 0/1 it is possible to compute the following
PKs simply by incrementing the first PK value.
(see https://stackoverflow.com/a/16592867/3665878)

SQLite on the other hand will return only the last PK.

Postgres and MongoDB both return all the PKs in the `res.rows` array.

Related: #442
B4nan added a commit that referenced this pull request Aug 9, 2020
This method can be used for bulk inserts. It works in all existing drivers,
but has some limitations in SQLite and MySQL/MariaDB. Those drivers do not
return all the just created PKs.

MySQL/MariaDB will return PK of the first entity in the batch. If we have
`innodb_autoinc_lock_mode` set to 0/1 it is possible to compute the following
PKs simply by incrementing the first PK value.
(see https://stackoverflow.com/a/16592867/3665878)

SQLite on the other hand will return only the last PK.

Postgres and MongoDB both return all the PKs in the `res.rows` array.

Related: #442
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.

None yet

1 participant