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
Chris Rutherford
@cjrutherford
it's okay, I just didn't specify a database, and used unambiguous table names to get the right DB. i.e: select * from [database].[dbo].[tableName]
rdking
@rdking
Hi all. I'm trying to figure out how to receive the 'row' event from a query run against a Request object. The code looks like this:
this[data] = await new Promise((resolve, reject) => {
    var request = new sql.Request(this[db]);
    var query = queries.getErrors;

    //get the records for the block #blockNo
    request.on('row', (row) => {
        console.log(`Got row!`);
    });
    request.query(query, (err, result) => {
        if (err) {
            console.error(`An error occurred while processing the request: \n${err}`);
            reject(err);
        }
        else {
            console.info(`Received ${result.recordset.length} records.`);
            resolve(result.recordset);
        }
    });
}) || [];
Problem is that even though I get 500+ records back, the row event never fires. Any suggestions?
rdking
@rdking
nvmd, just needed to turn on streaming...
Thomas Beckley
@teb951999
Hey! Does anyone knwo how to simply open a connection async, make a request async and close eonnction
I don't want to deal with calbacks
David Gasperoni
@mcdado
@teb951999 if you want to do async you either use callbacks or promises
I’m afraid
Maybe await / async by you need a recent version of Node, and personally I never used it
Chris Rutherford
@cjrutherford
I'm trying to pull in data from five different databases, and it looks like everything is coming through, but I can't continue because of this trace stack... I'm not sure where the unhandled promise rejection is located. Is it in my code? here's the call stack:
(node:18908) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
warning.js:18
    at Function.all (<anonymous>)
    at c:\Users\rutherfordc\Documents\GitHub\migration-plus\index.js:10:11
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
(node:18908) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
warning.js:18
(node:18908) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
warning.js:18
(node:18908) UnhandledPromiseRejectionWarning: ReferenceError: results is not defined
warning.js:18
    at c:\Users\rutherfordc\Documents\GitHub\migration-plus\index.js:15:11
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
(node:18908) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
Jason Luboff
@JLuboff
@cjrutherford Do you have this bit Symbol(Symbol.iterator) some where in your code? Or in a query?
Chris Rutherford
@cjrutherford
Sorry I found out it was because I was using Promise.all() with an object instead of an array..... sorry
Jason Luboff
@JLuboff
All good, I may not have even had the answer but still try to help :smile:
vijaylakkavaram
@vijaylakkavaram
hi every one
can any one tell me how to do transcations in node js for mssql?
to write transactional queries in node for mssql queries?/
help me
David Gasperoni
@mcdado
I think you just write them in the SQL queries? You just need to make sure you use the same connection for transaction
Sorry I yet never written a transaction
Jason Luboff
@JLuboff
@vijaylakkavaram The docs explain how to use a transaction https://www.npmjs.com/package/mssql#transaction
If you need to set an isolation level, you just do
transaction.begin('SERIALIZABLE').then(() => { ...
Chris Rutherford
@cjrutherford
Hi there all, trying to connect to an old SQL server 2000 instance, and I'm using SQL.connect() work a template strong building the connection string how can I add in the TDS version to that? Or how would I convert to a config object?
Chris Rutherford
@cjrutherford
NVM. Got it. Just moved away from the template string
andrew bernard
@drexler
anyone else get intermittent ConnectionErrors with mssql?
Jason Luboff
@JLuboff
@drexler Are you using SQL Express?
andrew bernard
@drexler
yes @JLuboff
@JLuboff is there a known issue with sql server express? i'm doing against an AWS RDS instance using that version.
Jason Luboff
@JLuboff
@drexler I had a similar issue. I can't fully recall the fix.. I seem to remember it involved something in the server configuration manager
Checking the settings now to see if I can recall
andrew bernard
@drexler
thx
Jason Luboff
@JLuboff
I know I had to enable SQL Server Browser... and Enable TCP/IP protocol but don't recall if that was to do with this. Let me go way back in my git log to see if I made a note
Jason Luboff
@JLuboff
@drexler Sorry...can't find any notes I made :( but I know I enabled those two items above and I only use my server name and omit the instance name. servername as opposed to servername\\Instancename
andrew bernard
@drexler
thanks a lot. i'll dig in more.
Ali Peyman
@alipeyman1997_gitlab
Hi, I`m using SQL server for my node project, what is the best module for preventing SQL injection?
and Which modules do you use for your security?
David Gasperoni
@mcdado
Hmm, I thought if you pass values to input parameters you can’t get SQL Injections
Igor Savin
@kibertoad
There is currently an ongoing discussion in the repo regarding dropping Node 4 support; is anyone in the channel still running Node 4 on a server?
Mikhail Maslyuk
@Mikhail-MM
What exactly is the difference between using the mssql vs the tedious package from npm? At a glance the code for both seems fairly similar?
andrew bernard
@drexler
@Mikhail-MM mssql is a higher-level abstraction which uses tedious as its driver.
Alex Tunick
@AlexanderTunick
Hi! Guys, can't succeed in querying for only one out of all my tests where get
RequestError: Conversion failed when converting the varchar value '1.93' to data type int.
Though this query successfully passes in Data Grip, don't you know why does tedious complain?
RequestError: Conversion failed when converting the varchar value '1.93' to data type int.
    at handleError (node_modules/mssql/lib/tedious.js:519:15)
    at Parser.<anonymous> (node_modules/tedious/lib/connection.js:618:16)
    at Parser.<anonymous> (node_modules/tedious/lib/token/token-stream-parser.js:54:15)
    at addChunk (node_modules/readable-stream/lib/_stream_readable.js:291:12)
    at readableAddChunk (node_modules/readable-stream/lib/_stream_readable.js:278:11)
    at Parser.Readable.push (node_modules/readable-stream/lib/_stream_readable.js:245:10)
P.S a workable query is written out from Knex plan that uses mssql as client, so the query is correct and is being successfully run in Data Grip
Jason Luboff
@JLuboff
@Alextunchii It's failing due to 1.93 not being a valid int value. An integer is a whole number. You would need to convert to decimal or numeric
Alex Tunick
@AlexanderTunick
@JLuboff but, once again, I successfully querying this in Data Grip IDE but with help of mssql client I see this, why is it not proceeded?
Jason Luboff
@JLuboff
I'm not familar with Data Grip, so I can't answer that. Its possible that the IDE is transforming the data in some way.
Alex Tunick
@AlexanderTunick

Hi guys! Could you please explain to me is it ok to have connection status "sleeping" on SQL server after querying DB with node-mssql
I have this simple method:

async queryDatabase(queryOption) {
        try {
            // const pool = new sql.ConnectionPool(this.getConfigCsdb());
            let connection = await pool.connect(this.getConfigCsdb());
            let result = await connection.request().query(queryOption);
            result = result['recordset'][0][''];
            return result;
        } catch (e) {
            throw e;
        } finally {
            await connection.close();
        }
    }

Which works perfectly but want to confirm that it closes a connection.
After querying Database, using EXEC sp_who2; I see the connection bridge visible in the list of processes:

sleeping    Alexanders-MacBook-Pro-3.local    node-mssql

when I running query I'm observing status to be changed to "RUNNABLE" and after finishing it becomes "sleeping".

Should it be like that or it should vanish at all from the list of connection shown in EXEC sp_who2;?

Daniel Hensby
@dhensby
What version of the mssql lib is it? What do the docs say about sleeping connections?
Alex Tunick
@AlexanderTunick
"mysql": "^2.16.0",
I haven't found any mention about sleeping in the docs of node-mssql
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