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

fix: support multiple row insert on oracle #6927

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

wfpena
Copy link
Contributor

@wfpena wfpena commented Oct 17, 2020

change generated insert query to allow inserting an array of objects to oracle

fixes: #2434

@imnotjames
Copy link
Contributor

imnotjames commented Oct 17, 2020

Can you explain briefly how this works? Just curious - even a link to the oracle docs would be fine - not sure what features this is using in oracle

@wfpena
Copy link
Contributor Author

wfpena commented Oct 18, 2020

@imnotjames
I've just followed the idea based on this :https://stackoverflow.com/questions/39576/best-way-to-do-multi-row-insert-in-oracle

You can insert on oracle based on a query. So you can do something like:

ìnsert into table1
select ...

so what this change does is, create a query with the union of all the values on the array to be inserted, then place them on the insert statement.

@imnotjames
Copy link
Contributor

imnotjames commented Oct 18, 2020

Thank you for the context!

Makes lots more sense now. I do see notes about it not working well with sequences.

As such, can you add a test that uses a primary generated column?

@wfpena
Copy link
Contributor Author

wfpena commented Oct 18, 2020

I've already added that @imnotjames

@imnotjames
Copy link
Contributor

imnotjames commented Oct 18, 2020

Aha, I had only looked at the second model, didn't see the first one 🙈 I'll try to fully review this as soon as I can. Trying to get through the backlog while keeping up with new PRs.

@wfpena
Copy link
Contributor Author

wfpena commented Oct 18, 2020

I've had to add tests with primary generated columns and date columns, etc.

@wfpena
Copy link
Contributor Author

wfpena commented Oct 18, 2020

Aha, I had only looked at the second model, didn't see the first one 🙈 I'll try to fully review this as soon as I can. Trying to get through the backlog while keeping up with new PRs.

Thank you

@imnotjames imnotjames self-requested a review October 18, 2020 00:39
@wfpena
Copy link
Contributor Author

wfpena commented Oct 18, 2020

@imnotjames just realized I dind't leave the id null on the tests with primary generated, I might have to fix that.

@wfpena wfpena force-pushed the fix/oracle-multi-row-insert branch from a27ef58 to a54dd22 Compare October 19, 2020 11:34
change generated insert query to allow inserting an array of objects to oracle

fixes: typeorm#2434
@wfpena wfpena force-pushed the fix/oracle-multi-row-insert branch from a54dd22 to 599d187 Compare October 19, 2020 11:38
@wfpena
Copy link
Contributor Author

wfpena commented Oct 19, 2020

@imnotjames just realized I dind't leave the id null on the tests with primary generated, I might have to fix that.

@imnotjames the tests are fixed now.

@imnotjames imnotjames added the hacktoberfest-accepted label hacktoberfest label Oct 26, 2020
@pleerock
Copy link
Member

Good we have oracle tests running on CI now. Probably this can be merged?

@pleerock pleerock merged commit a5eb946 into typeorm:master Oct 26, 2020
dolsup pushed a commit to dolsup/typeorm that referenced this pull request Nov 3, 2020
change generated insert query to allow inserting an array of objects to oracle

fixes: typeorm#2434
nebkat added a commit to nebkat/typeorm that referenced this pull request Nov 18, 2020
nebkat added a commit to nebkat/typeorm that referenced this pull request Nov 18, 2020
zaro pushed a commit to zaro/typeorm that referenced this pull request Jan 12, 2021
change generated insert query to allow inserting an array of objects to oracle

fixes: typeorm#2434
zshipleyTAG pushed a commit to Amherst-Development/typeorm that referenced this pull request Oct 7, 2022
* typeorm-0.2.30: (212 commits)
  version bump
  docs: fix javascript usage examples (typeorm#7031)
  fix: resolve migration for UpdateDateColumn without ON UPDATE clause (typeorm#7057)
  fix: Error when sorting by an embedded entity while using join and skip/take (typeorm#7082)
  fix: resolves Postgres sequence identifier length error (typeorm#7115)
  feat: closure table custom naming (typeorm#7120)
  feat: relations: Orphaned row action (typeorm#7105)
  docs: fix invalid code block in "find many options" (typeorm#7268)
  docs: Embodying the example (typeorm#7116)
  docs: document withDeleted option (typeorm#7132)
  fix: return 'null' (instead of 'undefined') on lazy relations that have no results (typeorm#7146) (typeorm#7147)
  docs: update cascade options (typeorm#7140)
  docs: add .ts to supported ormconfig formats (typeorm#7139)
  fix: improve stack traces when using persist executor (typeorm#7218)
  refactor: remove Oracle multirow insert workaround (since typeorm#6927) (typeorm#7083)
  feat: add NOWAIT and SKIP LOCKED lock support for MySQL (typeorm#7236)
  docs: update OneToMany grammar (typeorm#7252)
  feat: JavaScript file migrations output (typeorm#7253)
  docs: update Repository.ts (typeorm#7254)
  chore: update dependency cli-highlight to v2.1.10 (typeorm#7265)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted label hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QueryBuilder insert for Oracle failed
3 participants