v2.0.7
better sproc param management - use a param object over an array when calling
now you can use an input object
const spName = 'test_sp_get_optional_p'
const a = 10
const b = 20
const def = `alter PROCEDURE <name> (
@plus INT out,
@a INT = ${a},
@b INT = ${b}
)
AS begin
-- SET XACT_ABORT ON;
SET NOCOUNT ON;
set @plus = @a + @b;
end;
`
call with no params, the driver now assumes they are default input and will not bind them i.e.
const o = {}
proc.call(o, (err, results, output) => {
you can bind one param
const o = {
a: 10
}
proc.call(o, (err, results, output) => {
or both
const o = {
a: 10,
b: 20
}
proc.call(o, (err, results, output) => {
i have tried quite a few combinations including all output and 1 optional
const a = 20
const def = `alter PROCEDURE <name> (
@t1 INT out,
@t2 INT out,
@t3 INT out,
@a INT = ${a}
)
AS begin
-- SET XACT_ABORT ON;
SET NOCOUNT ON;
set @t1 = @a;
set @t2 = @a * 2;
set @t3 = @a * 3;
end;
const o = {}
proc.call(o, (err, results, output) => {
assert.ifError(err)
if (output) {
assert(Array.isArray(output))
const expected = [
0,
a,
a * 2,
a * 3
]
assert.deepStrictEqual(expected, output)
I will release shortly