Error checking - get diagnostics vs. sqlcode
Posted in 2006
Topics: Error Codes & Troubleshooting
Has anyone found any advantages to using "get diagnostics"? We're trying to establish error-checking standards and a co-worker pointed out to me that Informix manuals point out that this is X/Open and ANSI compliant as opposed to the sqlca structure and it also can report multiple errors. So, I played around with it a little bit, generating obvious errors, like accessing a locked table and non-existent columns and tables, but was unable to generate any multiple errors beyond what would be reported by sqlcode and the accompanying ISAM error. As far as being ANSI, if we ever needed to actually be ANSI compliant, I suspect we'd have so many other things to worry about, this would be a minor consideration, especially if we created a standard error handling routine which all our apps used. Frankly, I think reporting the sqlcode, ISAM and sqlerrm tells us all we need. I don't see much use in human readable error messages (that's what finderr is for, isn't it?) and the most common errors are easily recognizable. Doesn't everyone know what -201, -217, -239, -242, -284 mean just by looking at the number by now? :-) (That is unless you never make any mistakes and your programs never generate any errors). On a related note, does anyone think they have perfected the most optimal error checking strategy? --------------------------------- Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
On 5/2/06, Danny Wright <dwright_colorado@yahoo.com> wrote: > Doesn't everyone know what -201, -217, -239, -242, -284 mean just by looking > at the number by now? No. I had to check 3 out of 5 - the last three listed. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/