serhiy.zvedenyuk wrote:
A tiny update.
2 Otis: Suppose I do understand what you mean as a solution to the situation. I believe it's something like modifying the stored procedure as introducing a superfluous output parameter e.g.
ALTER PROCEDURE [dbo].[ProcessGoods]
@intGoodsID int = 0,
@result int out --just to force generator to create an ref parameter
AS
BEGIN
SET @result = 1;
-- RETURN -- no return is required/processed anymore
END
and then the signature of 2.6 generated wrapper will remain unchanged.
Is that the only solution?
It's the preferred solution, as it's uniform and standarized: output of a proc is always through output parameters, and it works for all types (as return values are int only)
BTW. In SP call editor I still can see the "ReturnValue" option for direction (besides Input, Output, InOut), is that just rudimentary and cannot be used?
Thanks ahead!
-S.
It's a glitch, we have all values there, 'returnvalue' is no parameter type which is recognized in the meta-data. In v2.x templates, it was added as a special parameter regardless if the proc did use a return statement or not, as you can do that with an Int32 parameter called 'RETURNVALUE'. MS' Books Online suggests return values are used for signaling failure/success (0 is success, 1 is failure), not for returning actual values, use output parameters for that.
So if there's a way to change the proc, I'd absolutely do it. If you're stuck with the signatures of the procs involved (I don't think there are that many, considering the fact returnvalue is bound to be an int), there is a way to get this working, but we won't add it to the main templates.
It works by adding a parameter to the set of parameters for the proc called RETURNVALUE, being an int and having a direction of ReturnValue. when the proc is called, this parameter is automatically set with the value returned. There's an include template, called proceduresInclude.template which builds the Create...call methods. There, the returnvalue parameter should be added. (as the last parameter)
Then in the proc template (e.g. actionProceduresAdapter.template), you have to add extra code to the method block to return the return value as a ref. I'd do this in a new method using the same method template code as the one currently already there, but with an extra int32 ref parameter for the output parameter.
This only makes sense for sqlserver btw. But, if it's possible, change the proc signatures instead.