[CONJS-189] connector doesn't seem to support multi statements. Created: 2022-02-15 Updated: 2022-04-29 |
|
| Status: | Open |
| Project: | MariaDB Connector/node.js |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Tom Miller | Assignee: | Diego Dupin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
node => v16.13.1 |
||
| Description |
|
We use stored procedures for everything. We also use sequences and want to return the sequence number back from the stored procedure as an out parameter. We still haven't gotten to select statements yet in our prototype work, but that is beginning to scare me too. I am new to JavaScript, so it could be me making a newbie mistake with promises. Here is my route.
And I get this as my result from my console.log deconstruction of the dbResponse object: , meta: [ [ColumnDef] ] ], , , meta: [ [ColumnDef] ] ] , ] [ , ] |
| Comments |
| Comment by Tom Miller [ 2022-02-15 ] | ||||||||||||||||
|
I am new to JavaScript and I may be missing some syntatical sugar, but this is what I came up with as a work around:
I am hoping I am missing something or you will add something to the system to make this information more accessible for multi-statement queries without jumping through hoops. | ||||||||||||||||
| Comment by Diego Dupin [ 2022-02-18 ] | ||||||||||||||||
|
I'm not sure to understand the problem. With actual driver, if you have some OUT parameters, you'll have to use user variable like you indicate.
With 3.0 release (before the end of the month), it can be simplier :
output parameters will be returned as a resultset without need to use user variables. | ||||||||||||||||
| Comment by Tom Miller [ 2022-02-18 ] | ||||||||||||||||
|
My concern is how hard it is to get to the stuff in the result.
It currently doesn't throw an error either. I have to do this manually:
My main problem is needing to access everything like this:
This is very error prone. Something like this is more logical and less error prone:
Or is this available already and I just don't know it? Do you need testers for the new connector? | ||||||||||||||||
| Comment by Tom Miller [ 2022-04-29 ] | ||||||||||||||||
|
I have upgraded to version 3. I like the new response, but It doesn't seem you have the ability for me to pick up the error. It doesn't throw an error and the error message is the same old response as before. Now I have to figure out which "response" envelope is being returned and then pick through the rubble. It would be nice to have a dbResponse.error.code and dbResponse.error.msg This is the easiest one to work with I have seen so far (mssql): console.log(result.recordsets.length) // count of recordsets returned by the procedure If I have 5 statements in the stored procedure, there are 5 numbers in the "rowsAffected". Can I get the best practices for catching an error with version 3.0? |