You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function callProcedure(pool, name, params, ip='') {
return new Promise((resolve, reject) => {
pool.acquire(function (err, connection) {
var data = [];
var request = new tedious.Request(name, function (err, count, rows) {
if (err) {
//don't need to close the connection, put it back to pool
connection.release();
logger.error(`${ip}:${name}: ${err.stack}`)
reject(`Error occured when executing request: ${err.stack}`)
}
else {
//handle completion for current connection and request object
//don't need to close the connection, put it back to pool
connection.release();
}
});
if (params != null && params.length > 0) {
//add parameter to request, parameter should be initiated at each class
for (var i = 0, len = params.length; i < len; i++) {
request.addParameter(params[i].name, params[i].type, params[i].value)
}
}
request.on('row', function (columns) {
var obj = {};
for (var i = 0, len = columns.length; i < len; i++) {
obj[columns[i].metadata.colName] = columns[i].value;
}
data.push(obj);
});
request.on('doneProc', function (rowCount, more, returnStatus) {
logger.info(`${ip}:${name}:Stored procedure ${name} executed, rows ${rowCount}, more ${more}, status ${returnStatus}`);
resolve(JSON.stringify({data}))
});
if (connection != null) {
connection.callProcedure(request);
}
else {
logger.error(`${ip}:${name}: Custom error => Connection is null!`)
reject('Custom error => Connection is null!')
}
});
});
}
Ianchocks said:
Hi @notestyle, are you having the same 'callback' issue as #917? If so are you also using tedious-connection-pool?
Edit: We actually don't have merge permissions for the tedious-connection-pool since it is a different repository than tedious itself.
The text was updated successfully, but these errors were encountered:
I saw tediousjs/tedious#917 this issue. But why didn't you fix in the master branch?
Version:
"tedious": "^6.4.0",
"tedious-connection-pool": "^1.0.5",
Code:
function callProcedure(pool, name, params, ip='') {
return new Promise((resolve, reject) => {
pool.acquire(function (err, connection) {
var data = [];
}
Ianchocks said:
Hi @notestyle, are you having the same 'callback' issue as #917? If so are you also using tedious-connection-pool?
Edit: We actually don't have merge permissions for the tedious-connection-pool since it is a different repository than tedious itself.
The text was updated successfully, but these errors were encountered: