tediousjs/tedious-connection-pool

request.transformIntoExecuteSqlRpc() is not a function

JaggieG opened this issue · 4 comments

  • tedious @ v14.0.0 and tedious-connection-pool @ v1.0.1
  • Connecting to an Azure DB, although I get the same issue with a standard local SQL as well.

Code

var ConnectionPool = require('tedious-connection-pool');
var Request = require('tedious').Request;

var poolConfig = {
    min: 2,
    max: 4,
    log: true
};
const connectionConfig = {
   //connection details
  };

//create the pool
var pool = new ConnectionPool(poolConfig, connectionConfig);

//acquire a connection
pool.acquire(function (err, connection) {
    if (err) {
        console.error(err);
        return;
    }
    //use the connection as normal
    var request = new Request('select 42', function(err, rowCount) {
        if (err) {
            console.error(err);
            return;
        }

        console.log('rowCount: ' + rowCount);

        //release the connection back to the pool when finished
        connection.release();
    });

    request.on('row', function(columns) {
        console.log('value: ' + columns[0].value);
    });
    
    connection.execSql(request);
});

Receive this:

connection.js:1359 - TypeError: request.transformIntoExecuteSqlRpc is not a function

If I use the tedious library without the pooling, then everything works fine

Possible Solution

I can remove the request.transformIntoExecuteSqlRpc() call in connection.js and the connection is then sent to the server, but it obviously fails as the statement is not interpreted correctly

Environment

Node.js Windows

Looks like it was removed in v14.3.0 in this commit.

Getting the same error. Is there a fix for this?

Can anyone confirm whether this is still an issue in tedious-connection-pool2@2.1.0?