Skip to content

How to handle output parameters from stored procedures #16

@nytamin

Description

@nytamin

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions