[eluser]smidoid[/eluser]
Why over-complicate it?
Code:
$this->db->simple_query
Does the same thing (faster) and doesn't return ANY error: so use with caution!
This is a public method on line 440 of DB_driver (in 1.7.0) anyway. ;-)
There's a very good argument to allow PHP to ignore duplicate inserts in some rare cases - and it's quicker to ignore the error in the same way as you might use "@" in PHP if you know it might happen.