Welcome Guest, Not a member yet? Register   Sign In
Can CI handling this db error using a library>
#1

[eluser]Unknown[/eluser]
I got the following error:

Error Number: 1062

Duplicate entry 'Tue, 13 Mar 2012 12:50:47 +0000-Level1-@united huge #customerser' for key 'usable_tweets'

I have three columns in a unique index, and this duplicate kicked out the following error--which broke my program. Now, since this is a MySQL error, I was wondering if there is a way prevent this error from breaking the program, kicking off a warning, but continuing on with the rest of the functionality.

Maybe a way to utilize the db transaction or some other functionality / library I'm not aware of.

Thanks,



#2

[eluser]Aken[/eluser]
You can use DB transactions to test for a valid change - those are already built into most of the common DB drivers in CI.

You could also do some verifying of unique data prior to inserting, so you'll know beforehand if there will be an error.




Theme © iAndrew 2016 - Forum software by © MyBB