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

upsert operation #4

Open
vinniks29 opened this issue Feb 1, 2017 · 2 comments
Open

upsert operation #4

vinniks29 opened this issue Feb 1, 2017 · 2 comments

Comments

@vinniks29
Copy link

This is not an issue but a query. How can we test for upsert operation? I found method for insert/update and delete but not sure how to check for upsert

@meajinkya
Copy link

@vinniks29 We also needed upsert operation. We are working on implementing it. If possible we will send a pull request for this. :)

@FishOfPrey
Copy link
Contributor

I've implemented a custom version of upsert for ESAPI.
One of the challenges way around how you define the whitelist of applicable fields to upsert.

I found that if the underlying operation turns into an insert you need to verify against one set of fields. In turn, if it is an update you need a different set of fields as some fields can only be inserted but not updated. It was a bit ugly, but I found I needed to pass through both sets of field names and then determine which to apply based on the ID being present.

However, that doesn't help you if you are upserting based on an external ID. How do you know if you are doing an insert or update without first checking if the record already exists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants