Skip to content

Add Upsert/UpsertBatch to builder #6367

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

Closed

Conversation

sclubricants
Copy link
Member

@sclubricants sclubricants commented Aug 11, 2022

This PR adds Upsert and UpsertBatch methods to builder.

This supersedes #6294

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added 4.3 enhancement PRs that improve existing functionalities database Issues or pull requests that affect the database layer labels Aug 11, 2022
@sclubricants
Copy link
Member Author

@kenjis

I'm working on a branch that combines this PR with #6373 and refactors everything.

Putting it all together helps to better envision and combine things. Upsert shares some things with Insert and some with Update.

When I get everything working combined I'll share so you guys can see this big picture.

There are a few things with this PR and #6373 I think I'd like to rework a bit. One thing is how protectIdentifiers is applied and how that affects handling of arrays of constraints and update keys. I'd like them to be consistent in Insert/Upsert/Update batch methods. Then will use some common functions that will apply the protectIdentifiers.

@sclubricants
Copy link
Member Author

Can we agree that the primary purpose of methods like setInsertBatch, setUpdateBatch, or my proposed methods setBatch, is to enable collecting of data without executing. This might be in a loop such as reading data from a csv file and setting the data for batch insert. Other than that it might be used to get the sql statements without executing them.

If the reason is this then we only need parameters needed setting the data.. the data itself and whether to escape or not. Things like batch size is not necessary information for setting the data.

@kenjis kenjis added the stale Pull requests with conflicts label Aug 21, 2022
@sclubricants sclubricants added stale Pull requests with conflicts and removed stale Pull requests with conflicts labels Aug 22, 2022
@sclubricants sclubricants removed the stale Pull requests with conflicts label Aug 23, 2022
Copy link
Member

@kenjis kenjis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has only one commit.
The previous PR had more commits.
Please revert this PR to look like the commits in the previous PR.

@tomek-artneo
Copy link

Good job @sclubricants 👍 This feature will help me a lot 😃

@sclubricants sclubricants deleted the UpsertUpsertBatchNew branch October 14, 2022 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Issues or pull requests that affect the database layer enhancement PRs that improve existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants