Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 14:34
    willmorgan commented on 889cbf1
  • Jan 31 13:15
    gsamal commented on 889cbf1
  • Jan 31 13:10
    dhensby closed #797
  • Jan 31 13:10
    dhensby commented #797
  • Jan 31 13:07
    dhensby closed #795
  • Jan 31 13:07
    dhensby commented #795
  • Jan 31 12:58
    gsamal commented #789
  • Jan 31 11:50
    cesco69 opened #797
  • Jan 31 10:22

    dhensby on master

    Update changelog for v5 Merge pull request #796 from dh… (compare)

  • Jan 31 10:22
    dhensby closed #796
  • Jan 31 09:53
    dhensby commented #789
  • Jan 31 09:52
    dhensby commented #778
  • Jan 31 09:51
    dhensby review_requested #796
  • Jan 31 09:51
    dhensby opened #796
  • Jan 31 06:45
    suckerp commented #795
  • Jan 31 02:58
    liumorgan starred tediousjs/node-mssql
  • Jan 31 02:15
    zhoukk starred tediousjs/node-mssql
  • Jan 30 22:22
    vjpr edited #795
  • Jan 30 22:22
    vjpr edited #795
  • Jan 30 22:22
    vjpr opened #795
Alex Tunick
@AlexanderTunick
it just says that close()
Close all active connections in the pool.
And I would be grateful to know in which status it leaves connection ultimately
Daniel Hensby
@dhensby
Mysql? V2? That's not this lib, then
I think it's an operating system level issue and not to do with the lib.
It's nothing to worry about unless you start seeing hundreds of connections
Alex Tunick
@AlexanderTunick
miscopied "mssql": "4.1.0",
Daniel Hensby
@dhensby
You'll want to upgrade. That's very old and there have been lots of improvements around pooling. But I also suspect this is just an internal quirk of SQL Server
Alex Tunick
@AlexanderTunick
Yeah, I also suspect it. About upgrade I would, but I use knex query builder that doesn't work with the last version, though some time has flown, need to recheck the last co-workable version
Daniel Hensby
@dhensby
It does now, I've worked extensively on improving that.
Alex Tunick
@AlexanderTunick
@dhensby wow, good news, thank you very much for informing me!
Daniel Hensby
@dhensby
👍
mn567
@mn567
The connect example here is wrong: https://www.npmjs.com/package/mssql#connection-pools
const pool2 = new sql.ConnectionPool(config, err => {
// ... error checks
}).connect();
I get an error saying already connecting
also connect() returns promise which gives error on the next line
pool2.on('error', err => {
// ... error handler
})
David Gasperoni
@mcdado
If you put a callback it will already start connecting
Either omit the callback and use the promise, or embrace callback hell
Daniel Hensby
@dhensby
@mn567 yes, they are wrong - issue #844 , fix #846 - fixed in v6 docs
dhaneshhs
@dhaneshhs
is there any sql query generator which works well with mssql which support easy way of generating INSERT query as i have more than 30 columns to be inserted to the table
Daniel Hensby
@dhensby
dhaneshhs
@dhaneshhs
Thanks @dhensby
TK
@tonnykayage
Mssql inducing memory leaks when i run a benchmark at 10k concurrency, Memory increases overtime until i'm out of memory.
_g[conn].request().query(preparedQuery, function (err, records) {
_g[conn].on('error', errdb => {
reject(_t.i(1005, configurations.errors, errdb));
Logger.log("error", "tmsmssql", "SYS", _t.i(1005, configurations.errors, errdb));
return;
});
if (err) {
reject(_t.i(1003, configurations.errors, JSON.stringify(err)));
} else {
if (records.rowsAffected[0] > 0) {
if (op === 'INSERT' || op === 'UPDATE' || op === 'DELETE') {
resolve(_t.i(200, null, records));
} else {
resolve(_t.i(200, null, records.recordset));
}
} else {
reject(_t.i(1004, configurations.errors));
}
}
});
Igor Savin
@kibertoad
Which mmsql version are you running?
TK
@tonnykayage
Mssql 5.1.0 @kibertoad
Taldrit
@Taldrit
I have a problem with the tutorial. I tried the ConnectionPool and always got the message that .on() is not a function and then I commented that out and tried it without, but now I get the error Already connecting to database. What did I do wrong?
const mssql = require('mssql');
let config = {...}; // that one is correct, I tested it with a pure simple query
const sqlPool = new mssql.ConnectionPool(config, err => {
console.log(err);
}).connect();
sqlPool.on('error', err => {
log(err);
});
const sqlQuery = queryString => {
return sqlPool.then(pool => {
pool.request().query(queryString)
}).then(result => {
console.dir(result);
})
};
sqlQuery("SELECT * FROM users");
David Gasperoni
@mcdado
If you pass a callback to ConnectionPool, it will not return a promise

Instead of this

mssql.ConnectionPool(config, err => { console.log(err);

Try like this:

mssql.ConnectionPool(config) .then((result) => {}) .catch((reason) => {});

Error handling is in the catch
.catch((reason) => {
    console.error(reason);
});
Taldrit
@Taldrit
grrrr... no I get the error: TypeError: (intermediate value).then is not a function
maybe I need a complete functioning module to adjust to my needs instead of small code samples. Do you have an example that I could use? I search for one that uses one connection for a long time (there maybe many calls to the same database from the same server without any other connections. So 1 connection that stays open for a longer time should be fine). The samples I found and that work all use a single call on a connection inside the connection call. But that way the connection would have to be closed and reopened on every query.
David Gasperoni
@mcdado
I think I know what you mean, personally I created a class that is technically a singleton for each database. Basically the connectionPool is module variable that calling modules access to. Then anytime I want to run requests I listen to the (already happened) on(“connect”) event
John McCallister
@mccallister_ftw_twitter
Hello