You can clone with
We have the functions insert_batch() and update_batch(), but no replace_batch() is provided.
Can replace_batch() be created?
If you can and want to do it - submit a pull request, but I don't really see many use-cases for this functionality, if any.
@narfbg I want to do this, but I need to find some time.
And I could tell you a number of use-cases :)
Since you've requested it - I'm sure you could, from your point of view. But apparently, so far it's only you that needs such a functionality and your reasoning so far is "Since there's insert_batch() and update_batch(), why no replace_batch()". That doesn't sound like a popular feature request. :)
Would be included if you suggest a proper implementation though, I'm not trying to discourage you. :)
A fair reason for replace_batch() is because you won't need to make a delete() >> insert_batch(), or an update_batch() on existent items and insert_batch() on new ones
... that would be the whole point, of course. The REPLACE clause wouldn't exist otherwise. But who does both insert_batch() and update_batch() at the same time? :)
Just to clarify:
I have a form like this:
entities ___________ config1 ____________ config2
entity1 [ ] [ ]
entity2 [ ] [ ]
entity3 [ ] [ ]
When submitting this form, I can make an insert_batch().
New entities can be added (on another form, by another user) and "configs" can be updated. So... users can change existent entities' "configs" while setting the new entities' "configs". To do this: insert_batch() and update_batch() OR delete() >>> insert_batch().
I wanted to start working on it, but it needs to be added on every single db driver.
I can't do this, sorry...