Welcome Guest, Not a member yet? Register   Sign In
Unxpected behaviour with $this->db->update_batch() and $this->db->insert_batch()
#2

[eluser]Aken[/eluser]
You bring up a valid concern. Let me explain a little bit about what happens in those two methods, though.

Both batch methods split up the queries into groups of 100 rows. So if you have 550 rows of data to insert or update, six queries will be run. While it's certainly possible to track if any of those queries do fail, it is a little misleading to say that the entire method failed, when only one actual query didn't perform correctly.

For things like this, you'll probably want to be using transactions anyway, if you don't want to commit all the changes unless they all work. But people don't always take that precaution.

I agree that something could be done to help make the returned values more consistent with their single brethren, just not sure of what. I suggest creating an issue on Github, maybe even a pull request with your own solution suggestion, and see what kind of ideas and feedback come from it.


Messages In This Thread
Unxpected behaviour with $this->db->update_batch() and $this->db->insert_batch() - by El Forum - 07-24-2012, 03:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB