node-odbc icon indicating copy to clipboard operation
node-odbc copied to clipboard

Rewrite call procedure

Open markdirish opened this issue 10 months ago • 4 comments

This PR changes the procedure workflow from:

SQLProcedures -> SQLProcedureColumns -> SQLExecDirect

to

SQLPrepare -> SQLDescribeParam -> SQLBind -> SQLExecDirect

This will allow users to call a procedure with just the procedure name, even if that procedure exists in multiple schemas/libraries.

markdirish avatar Apr 03 '24 02:04 markdirish

Will this allow CLOB parameters on procedure calls? See #355 for context

brandonp42 avatar Apr 03 '24 22:04 brandonp42

Hi Mark,

Just curious how close you are to releasing this change?

Thanks! Brandon

brandonp42 avatar May 20 '24 17:05 brandonp42

Would it make sense to use the old code path for drivers that don't support IPD?

brandonp42 avatar Jun 11 '24 23:06 brandonp42

Given the problems we've had with it, I think it'd be a better idea to design a way to have the user specify the direction as-needed.

Maybe something like:

// IN, OUT, INOUT exported by the node-odbc package
params = [
    { data: 1, direction: IN },
    { data: undefined, direction: OUT },
    { data: 'hello', direction: INOUT },
}
const result = await connection.callProcedure(null, null, 'MY_PROC', params);

Not sure if it actually matters on OUT vs INOUT. If not, it could be simplified by just binding them both as INOUT and then the direction field could be changed to a boolean is_output. Although, now that I'm thinking about it could just bind everything as INOUT in that case and not even worry about it. But that all hinges on whether database drivers are ok with binding that way.

kadler avatar Jun 12 '24 15:06 kadler