Christopher Hicks wrote:
On Fri, 4 Mar 2005, David Newman wrote:

How is the error handling? I'm writing a CGI::App now with DBI and I find that most of my time is writing error handling routines. If this query fails rollback and display an error, otherwise continue, etc. etc. It is alot of work.


It seems odd that the database is throwing you this many errors. Having worked with databases aimed at a variety of purposes (from weather forecasting to malpractice insurance) I've never had an app where the database through errors in production that had to be handled by the app. Those things are all cleaned up in development hopefully.

You might have cleaned up those places where bad code/design caused errors in development, but you can never get rid of things that might crop up due to network outages (remote db), database crashes (not often, but hopefully you code for them), etc.


Class::DBI does a good job of making sure that everything sent to the database is checked upon return. There are several places where you write custom SQL (or SQL segments) that are then turned into methods by Class::DBI/Ima::DBI and these are also checked. The only place you would have to do it manually is when you create a completely custom method that used the DBI handles directly, which isn't very often.

However, if there are places in your business logic that would require a rollback on failure, you would still have to catch and implement that. Typically I just perform some related group of actions, then issue a commit, then repeat. If something fails, the commit is never issued and Class::DBI does a good job of logging what failed.

Does that help?

--
Michael Peters
Developer
Plus Three, LP


--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to