Skip to content

Releases: TimelordUK/node-sqlserver-v8

cancel query

04 Jul 22:34
Compare
Choose a tag to compare

https://github.com/TimelordUK/node-sqlserver-v8/wiki#cancel

this is a fairly major rework of the code to support query cancel and all users are advised to test carefully before upgrading production environments.

The driver will work exactly as previous versions but for queries submitted in polling mode, cancel is now enabled.

    test('cancel single query from notifier using tmp connection - expect Operation canceled', function (test_done) {

        var q = sql.query(conn_str, sql.PollingQuery("waitfor delay \'00:00:59\';"), function (err) {
            assert(err);
            assert(err.message.indexOf('Operation canceled') > 0);
            test_done();
        });
        q.on('submitted', function () {
            q.cancelQuery(function (err) {
                assert(!err);
            });
        });
    });

    test('cancel single waitfor - expect Operation canceled', function (test_done) {

        var q = theConnection.query(sql.PollingQuery("waitfor delay \'00:00:20\';"), function (err) {
            assert(err);
            assert(err.message.indexOf('Operation canceled') > 0);
            test_done();
        });

        theConnection.cancelQuery(q, function (err) {
            assert(!err);
        });
    });

  1. new event q.on('submitted', function () { } can be used to detect when a query is actually submitted to the driver. This can help in diagnostics and is necessary for cancels submitted on ad hoc queries such as above.

node v8 compatibility / multiple error via raiserror() support

11 Jun 17:36
Compare
Choose a tag to compare
  1. binaries included for new Node V8 version.

#9

  1. chains of RAISEERROR will now be captured and returned allowing multiple errors to be managed.

$ node test\edge-case.js -t errors
[1] more = true err Error: [Microsoft][SQL Server Native Client 11.0][SQL Server][1]: Error Number 1 results null
[1] more = true err Error: [Microsoft][SQL Server Native Client 11.0][SQL Server][1]: Error Number 2 results null
[1] more = true err Error: [Microsoft][SQL Server Native Client 11.0][SQL Server][1]: Error Number 3 results null
[1] more = false err null results []
[1] completes more = false

 setInterval( () => {
                let qs = '';
                let repeats = 3;
                for (let i = 0; i < repeats; ++i) {
                    qs += `RAISERROR('[${x}]: Error Number ${i + 1}', 1, 1);`;
                }
                let q = conn.query(qs,
                    (err, results, more) => {
                        if (more && !err && results && results.length === 0) {
                            return;
                        }
                        console.log(`[${x}] more = ${more} err ${err} results ${JSON.stringify(results)}`);
                        if (more) return;
                        console.log(`[${x}] completes more = ${more}`);
                        ++x;
                    });
                q.on('msg', (err: v8Error) => {
                    //console.log(`[${x}]: q.msg = ${err.message}`);
                });
            }, delay);

connections stuck in busy state regarding error management.

10 Mar 23:11
Compare
Choose a tag to compare

#34

tediousjs/node-mssql#414

final candidate release for error management improvements relating to RAISERROR ; select .... which now providing severity is < 14 will proceed to the following select having raised the error. In this case the more flag will be set true on the error raising event indicating more data will follow. If severity >= 14 then the statement is terminated and select will not be executed.

prior to this release it would be possible to get the connection in a permanent "busy" state where it can then not service further queries.

 node test\edge-case.js -t busy --delay=5000 --severity=14 
>> queryRaw
  { Error: [Microsoft][SQL Server Native Client 11.0][SQL Server]User JS Error sqlstate: '42000', code: 50000 }
 null
<< queryRaw
>> queryRaw2
 { Error: [Microsoft][SQL Server Native Client 11.0][SQL Server]User JS Error sqlstate: '42000', code: 50000 }
  null
 << queryRaw2

 $ node test\edge-case.js -t busy --delay=5000 --severity=9
 >> queryRaw
    { Error: [Microsoft][SQL Server Native Client 11.0][SQL Server]User JS Error sqlstate: '01000', code: 50000 }
   null
   >> queryRaw
 null
 {
   "meta": null,
   "rowcount": -1
 }
  >> queryRaw
null
{
   "meta": [
   {
      "size": 10,
     "name": "",
     "nullable": true,
     "type": "number",
     "sqlType": "int"
     }
  ],
  "rows": [
  [
     2
  ]

bigint output parameters and re-patch folder baseline loader

08 Feb 23:30
Compare
Choose a tag to compare

issue #32

pull request #31

are in this release.

broken Node v7

08 Feb 01:18
Compare
Choose a tag to compare

apologies, V7 was also not working and hence has been corrected.

add back node 4 binaries!

08 Feb 00:46
Compare
Choose a tag to compare

#33

  1. small patch release to add back node 4 support, release on latest binaries across all node.
  2. small additions to the typescript module API
  3. additional test for module using prepared statements and refactor a little using the ASQ asyncquence.

pull request merge / typescript wrapper first draft

06 Feb 23:47
Compare
Choose a tag to compare
import {MsNodeSqlDriverApiModule as v8} from './lib/MsNodeSqlDriverApiModule'
export const sql: v8.v8driver = require('msnodesqlv8');

gain typing information by using the driver api mnodule. This is shown in use with the typescript mssql-demo.ts.

or use the promise based wrapper

import v8Meta = MsNodeSqlDriverApiModule.v8Meta;
import v8RawData = MsNodeSqlDriverApiModule.v8RawData;
import CommandResponse = MsNodeSqlWrapperModule.SqlCommandResponse;
import v8driver = MsNodeSqlDriverApiModule.v8driver;
import Connection = MsNodeSqlWrapperModule.Connection;

let sqlWrapper = new MsNodeSqlWrapperModule.Sql('use connection string');
// open connection, run query and close via a promise .....
 sqlWrapper.execute(this.testSelect).then(res => {
                assert.deepEqual(res.asObjects, this.expectedRows, "results didn't match");
                resolve();
            }).catch(e => reject(e));

look at DriverModuleTest.ts for other use cases such as event subscription or running a stored proc - return raw or object based results.

sqlWrapper.open().then(c=> {
 let command = c.getCommand().sql(`select 1+1 as v, convert(DATETIME, '2017-02-06')
.execute()
.then((res: CommandResponse) => {

});

memory leak and Node 7 support

03 Dec 21:04
Compare
Choose a tag to compare

issue

  1. this release fixes an issue where repeated connection open / close eventually crashes node instance due to memory leak in un-released handles.
  2. new binaries provided for latest node 7 release.

electron 1.4.3 support + latest node versions

15 Oct 11:56
Compare
Choose a tag to compare

this is a straight rebuild to support latest electron - please inform me of future breaks via an issue and I will try to republish working versions as soon as possible. Note that previous electron version is now removed you must be on 1.4.3 to use this module.

Node v6 latest binaries

20 Sep 20:27
Compare
Choose a tag to compare

this is a patch release containing support for latest v6 Node JS. Both 64 and 32 bit binaries are provided