Re: Stored procedure output parameter binding
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 15 Sep 2011 16:48:26 -0700 "Michael Gurfinkel [TSS]" <[email protected]> wrote: > After reading documentation of dbrpcparam I thought that if 3rd > parameter passed to it (BYTE status) is set to DBRPCRETURN then the > local variable bound to it will get the actual value placed into it > by stored proc, I can see why you thought that, but that's not the design. > but that is not working for me. In my example I have > to run dbretdata to actually retrieve the value. Then what is the use > of passing DBRPCRETURN ? The use of passing DBRPCRETURN is to tell the server to send parameter output data. If you don't set that flag, the value is not returned to the client, ever. The exact why of all this would have to be answered by the designers, but we can hazard a guess. dbrpcparam() is an input function. Converting it to an output function by means of DBRPCRETURN would invite bugs because it's subtle. The input parameter variable might well go out of scope before the results are all processed, which is when the server returns the data. If it's not out of scope, the value has changed, which would be a surprising effect for an input function! There would also be no way to know if in fact the server actually did return the data. (Just because you pass DBRPCRETURN doesn't mean the parameter was declared OUTPUT in the stored procedure.) dbnumrets() and friends give you that information. HTH. --jkl