meteor-mssql icon indicating copy to clipboard operation
meteor-mssql copied to clipboard

How to handle output parameters from stored procedures

Open nytamin opened this issue 9 years ago • 1 comments

I'd like to execute a stored procedure like this:

var opts = {
  sp : "procedureName",
  inputs : [
    { name: 'param1', type: Sql.driver.Int, value: 0 }
  ],
  outputs : {
    outputParam : Sql.driver.VarChar,
  }
};
Sql.sp(opts,function (err,res) {
  // handle response
});

But I haven't found a way to access the output parameters from there. (Is there one that I've missed?)

I've figured out that the parameter would be available in request.parameters.outputParam, but the request object is never exposed from within Sql.sp().

If the request object would've been returned from Sql.sp() the following code would be possible:

var request = Sql.sp(opts,function (err,res) {
  // handle response
  request.parameters.outputParam.value;
});

Have I missed something here, else I'll submit a pull request?

nytamin avatar Jan 11 '16 11:01 nytamin

This is almost certainly a bug. I'll take a pull request.

emgee3 avatar Jan 12 '16 17:01 emgee3