I’m working on a web-based application using mySQL, and I’ve used it in the past. I’ve never seen a mySQL error other then something during the development process — ie. poorly formed selects — but once its ‘working’ what kind of errors are there?
I’ve never seen an insert or select fail – can they? If the syntax is correct, why would they?
I’m mostly asking this with an eye toward figuring out what to do if an error actually does occour. If an insert/update fails, do I sleep a second and try again? How about a select? How many times before just giving up?
EDIT:
Maybe I asked this poorly, what I’m looking for is “How should I handle mySQL errors if and when they occour?”. In every sample I’ve ever seen its to just die — in a public application that seems very ugly. Is it worth retrying the command in a few seconds and then giving a error to the user and emailing the admin? Or just accept that a fatal error won’t get fixed.
Could be something as simple as someone shutting down the MySQL server.
There might be limits set on the MySQL server, e.g. MAX_QUERIES_PER_HOUR.
There can be errors or timeouts where the server drops the connection to the client (the popular CR_SERVER_LOST).
The data (file) may be corrupt which you may notice not until a query on the database/table runs.
Your test environment may have never run into a “packet too large” situation but then your production server does.
And many, many more… Have a read of http://dev.mysql.com/doc/refman/5.1/en/problems.html