Up Prev Next
From: "W dot Phillip Moore" <wpm at ms dot com>
Subject: Re: standard execution of stored proc
Date: Jun 17 1998 3:34PM
>>>>> "Phil" == W Phillip Moore writes:
>>>>> "Raja" == Raja Sambamurty writes:
Raja> Personally, I have been a convert ever since Michael enlightned
Raja> me about ->sql and now thats about all I use. I haven't had a
Raja> scenerio where it hasn't done what I am looking to do. I think
Raja> it beats the heck out of doing the whole loop with
Raja> dbcmd,dbexec,dbresults&dbnextrows combo. It also suits me well
Raja> since I loath to type more than I have to :-) my $0.02 worth
Phil> Have you also then tried using nsql()? If you like what the sql()
Phil> method can do for your code, you'll probably appreciate the nsql()
Phil> method even more.
Phil> Basically, nsql() was based on sql(), with several key enhancements.
Uh, oops. That one slipped through my keyboard. Let me finish that
nsql() provides more robust and integrated error handling. This
method is also provided with a pair of message and error handlers
(which you have to enable), and works with those to report any and all
errors with the method via an exported variable $DB_ERROR.
This decouples the error checking from the return value of the method,
which is pretty important. nsql() also checks a number of error
conditions that sql() does not (dbcmd() isn't checked, for example.
Unless your SQL is as complex as the couple of examples discussedby
Michael, using nsql(), and more importantly, encouraging junior
programmers who are *not* expert coders to use it, will greatly
simplify your code, and hopefully make it more robust as well.