[CONJS-113] return output parameter of stored procedure Created: 2019-11-27  Updated: 2021-09-15  Resolved: 2021-09-15

Status: Closed
Project: MariaDB Connector/node.js
Component/s: documentation
Affects Version/s: None
Fix Version/s: N/A

Type: New Feature Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Won't Fix Votes: 0
Labels: None

Issue Links:
Relates
relates to CONJS-153 support Prepared statement with 10.6 ... Closed
relates to CONJS-177 document retrieving stored procedure'... Closed

 Description   

Actual implementation permit stored procedure with output parameters only if passing parameters, and not retuning those immediately.

Actual will permits that in multiple commands, defining user variables first, then asking for them again:

con.query('CREATE OR REPLACE PROCEDURE ' +
        'multiplyBy2 (IN p1 INT, OUT p2 INT) ' +
        'begin ' +
        'set p2 = p1 * 2; ' +
        'end')
      .then(() => {
        return con.query('SET @val=10')
      })
      .then(() => {
        con.query('call multiplyBy2(?,@val)', [2])
      })
      .then(() => {
        return conn.query('SELECT @val')
      })
      .then(rows => {
        assert.equal(rows[0]['@val'], 4)
        done()
      })
      .catch(done)

This is not a simple task for now, since only text protocol is implemented, and this doesn't permit returning output parameters (MDEV-12400) This will need binary protocol implementation.



 Comments   
Comment by Diego Dupin [ 2021-09-15 ]

closing since done documenting with CONJS-177

Generated at Thu Feb 08 03:22:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.