Releases: TimelordUK/node-sqlserver-v8
4.4.0
description | link |
---|---|
next js example, note cant run driver on UI thread. | todo-with-nextjs_msnodesqlv8 |
using in typescript | msnodesqlv8_ts_sample |
js example typings in IDE | msnodesqlv8_yarn_sample |
using sequelize | msnodesqlv8-sequelize |
using mssql | msnodesqlv8_mssql_sample |
- update packages to latest
- fix for node-gyp build on node 22, node 23
import sql from 'msnodesqlv8'
import Connection = MsNodeSqlV8.Connection
import ConnectionPromises = MsNodeSqlV8.ConnectionPromises
async function t() {
const connectionString = "Driver={ODBC Driver 17 for SQL Server};Server=(localdb)\\node;Database=scratch;Trusted_Connection=yes;"
const con:Connection = await sql.promises.open(connectString)
const promises:ConnectionPromises = con.promises
const res = await promises.query('select @@servername as server')
console.log(JSON.stringify(res, null, 4))
await con.promises.close()
}
t().then(() => {
console.log('closed')
})
const connectionString = "Driver={ODBC Driver 17 for SQL Server};Server=(localdb)\\node;Database=scratch;Trusted_Connection=yes;"
const sql = require('msnodesqlv8')
const query = 'SELECT top 2 * FROM syscolumns'
async function runner() {
console.log(`using connection '${connectionString}' run query '${query}'`)
const res = await sql.promises.query(connectionString, query)
console.log(JSON.stringify(res, null, 4))
}
runner().then(() => {
console.log('done.')
}).catch(e => {
console.error(e)
})
electron v29,v30,v31,v32 node v22,v23
description | link |
---|---|
next js example, note cant run driver on UI thread. | todo-with-nextjs_msnodesqlv8 |
using in typescript | msnodesqlv8_ts_sample |
js example typings in IDE | msnodesqlv8_yarn_sample |
using sequelize | msnodesqlv8-sequelize |
using mssql | msnodesqlv8_mssql_sample |
- release binaries for electron v29,v30,v31,v32 (v28 not supported, v32 needs 020 compiler) #324
- node v22, v23 binaries
- patch PR from contributor on date parsing #318
- update packages to latest
- reworked typings to better interop with JS/TS
import sql from 'msnodesqlv8'
import Connection = MsNodeSqlV8.Connection
import ConnectionPromises = MsNodeSqlV8.ConnectionPromises
async function t() {
const connectionString = "Driver={ODBC Driver 17 for SQL Server};Server=(localdb)\\node;Database=scratch;Trusted_Connection=yes;"
const con:Connection = await sql.promises.open(connectString)
const promises:ConnectionPromises = con.promises
const res = await promises.query('select @@servername as server')
console.log(JSON.stringify(res, null, 4))
await con.promises.close()
}
t().then(() => {
console.log('closed')
})
const connectionString = "Driver={ODBC Driver 17 for SQL Server};Server=(localdb)\\node;Database=scratch;Trusted_Connection=yes;"
const sql = require('msnodesqlv8')
const query = 'SELECT top 2 * FROM syscolumns'
async function runner() {
console.log(`using connection '${connectionString}' run query '${query}'`)
const res = await sql.promises.query(connectionString, query)
console.log(JSON.stringify(res, null, 4))
}
runner().then(() => {
console.log('done.')
}).catch(e => {
console.error(e)
})
v4.2.0: Merge pull request #326 from TimelordUK/electron.v29
4.1.2
NextJS patch
please see https://github.com/TimelordUK/todo-with-nextjs_msnodesqlv8
for a sample NextJS application using msnodesqlv8
v4.1.1
- electron v27 binaries
- node v21 binaries
v4.1.0
typescript users note types are now split into their own module
import { Error, PoolOptions, Query, SqlClient, QueryDescription, Pool, PoolStatusRecord } from 'msnodesqlv8/types'
const sql: SqlClient = require('msnodesqlv8')
proven solution for Debian, Ubuntu running node 18, 20 experiencing SEGV core dump - install from src openssl 3.2
see appveyor and tool/openssl.sh
tested platforms
OS | Node Version | ODBC Version | SSL version | action |
---|---|---|---|---|
Windows 10 | 12, 14, 16, 18, 20 | 17, 18 | leave default | |
Windows 11 | 18, 20 | 18 | leave default | |
Ubuntu 22.04.2 | 18, 20 | 17, 18 | openssl 3.2 | e.g. tool/openssl.sh |
Ubuntu 20.04 | 18, 20 | 18 | openssl 3.2 | e.g. tool/openssl.sh |
Ubuntu 20.04 | 12, 14, 16 | 17, 18 | openssl 1.1 | leave default |
Lubuntu 20.04 | 18, 20 | 18 | openssl 3.2 | e.g. tool/openssl.sh |
Debian | 18, 20 | 17, 18 | openssl 3.2 | e.g tool/openssl.sh |
Alpine 3.16 | 18 | 18 | openssl 1.1.1t | leave default |
MacOS Big Sur | 18, 20 | 18 | libressl 2.8.3 | leave default |
-
#287 - unicode 16 bit col names
-
electron 25 binaries
-
electron 26 binaries
v4.0.0
typescript users note types are now split into their own module
import { Error, PoolOptions, Query, SqlClient, QueryDescription, Pool, PoolStatusRecord } from 'msnodesqlv8/types'
const sql: SqlClient = require('msnodesqlv8')
proven solution for Debian, Ubuntu running node 18, 20 experiencing SEGV core dump - install from src openssl 3.2
see appveyor and tool/openssl.sh
tested platforms
OS | Node Version | ODBC Version | SSL version | action |
---|---|---|---|---|
Windows 10 | 12, 14, 16, 18, 20 | 17, 18 | leave default | |
Windows 11 | 18, 20 | 18 | leave default | |
Ubuntu 22.04.2 | 18, 20 | 17, 18 | openssl 3.2 | e.g. tool/openssl.sh |
Ubuntu 20.04 | 18, 20 | 18 | openssl 3.2 | e.g. tool/openssl.sh |
Ubuntu 20.04 | 12, 14, 16 | 17, 18 | openssl 1.1 | leave default |
Lubuntu 20.04 | 18, 20 | 18 | openssl 3.2 | e.g. tool/openssl.sh |
Debian | 18, 20 | 17, 18 | openssl 3.2 | e.g tool/openssl.sh |
Alpine 3.16 | 18 | 18 | openssl 1.1.1t | leave default |
MacOS Big Sur | 18, 20 | 18 | libressl 2.8.3 | leave default |
v3.1.0
What's Changed
-
Bump qs from 6.5.2 to 6.5.3 by @dependabot in #269
-
Bump json5 from 1.0.1 to 1.0.2 by @dependabot in #272
-
allow more than 1 installed MS driver in linux and pick up latest for gyp build
Gyp by @TimelordUK in #274 -
binaries for node v20
-
binaries for latest electron including preview v24
-
continued modernisation of JS into classes for better maintenance
v3.0.1
This is a release containing a lot of reworking under the covers and should hence be tested thoroughly before deployment into production systems.
the focus has mainly been on precise binding specifically for stored procedures and bound tables such that always on encryption will work with all ODBC supported types that are compatible with this feature. datetimeoffset, time(n), date, real, datetime2, numeric, binary(n), varbinary(n), decimal, nvarchar(n), char(n), bit, bigint, tinyint, smallint, int all work with table binding and procedure calls.
float via encryption works only for a single parameter value in stored proc it does not work for bulk table binding.
money types do not work with ODBC and always on encryption
when using general queries conn.query('select * from mytable', ...) there will be no change in way the driver works - the type bound in driver on a parameter is essentilly 'guessed' based on presented JS type. This works fine as the server will translate over to exact column type - this will not work with always on encryption and you will likely receive errors stating there is a type mismatch between the guess made and actual column definition.
tvp is also not supported.
new promise to cancel a query from returned Query
it('use promise on query to cancel', async function handler () {
const conn = env.theConnection
const waitsql = env.waitForSql(20)
const q = conn.query(waitsql)
const err = await q.promises.cancel()
assert(err.message.includes('Operation canceled'))
})
new promise to call on a fetched procedure
await createProc(spName)
const msg = 'hello world'
const proc = await env.theConnection.promises.getProc(spName)
const res = await proc.promises.call({
param: msg
})
improved typings and JSDoc in index.d.ts - part 1 this will be continued in future releases, any contributions from TS typings experts very much welcome.
any changes must be compatible with current typescript test code
i.e. npm run build must compile
npm run build
> msnodesqlv8@3.0.0 build
> tsc
msnodesqlv8 git(master) node .\dist\samples\typescript\builder.js
IF OBJECT_ID('dbo.tmpTableBuilder', 'U') IS NOT NULL DROP TABLE dbo.tmpTableBuilder;
CREATE TABLE dbo.tmpTableBuilder ([id] int , [col_a] int NOT NULL, [col_b] varchar (100) NOT NULL, [col_c] int NOT NULL, [col_d] int NOT NULL, [col_e] varchar (100) NOT NULL)
[
{
"id": 0,
"col_a": 0,
"col_b": "str_0",
"col_c": 1,
"col_d": -1,
"col_e": "str2_0"
},
{
"id": 1,
"col_a": 5,
"col_b": "str_1",
"col_c": 2,
"col_d": 0,
"col_e": "str2_1"
},
{
"id": 2,
"col_a": 10,
"col_b": "str_2",
"col_c": 3,
"col_d": 1,
"col_e": "str2_2"
},
{
"id": 3,
"col_a": 15,
"col_b": "str_3",
"col_c": 4,
"col_d": 2,
"col_e": "str2_3"
},
{
"id": 4,
"col_a": 20,
"col_b": "str_4",
"col_c": 5,
"col_d": 3,
"col_e": "str2_4"
}
]
CREATE TYPE dbo.tmpTableBuilderType AS TABLE ([id] int , [col_a] int , [col_b] varchar (100) , [col_c] int , [col_d] int , [col_e] varchar (100) )
create or alter procedure dbo.tmpTableBuilder_tvp_inserter
(
@tvp dbo.tmpTableBuilderType READONLY
)
AS
BEGIN
set nocount on
INSERT INTO dbo.tmpTableBuilder
(
[id],
[col_a],
[col_b],
[col_c],
[col_d],
[col_e]
)
SELECT
[id],
[col_a],
[col_b],
[col_c],
[col_d],
[col_e]
n FROM @tvp tvp
END
id 0 equals true
id 1 equals true
id 2 equals true
id 3 equals true
id 4 equals true
done
always on encryption now working on stored proc and bound table calls - please see tests\encrypt.js
e.g with table below
CREATE TABLE node.dbo.test_encrpted_table (
[id] int IDENTITY(1,1) NOT NULL, [field] int ENCRYPTED WITH
(COLUMN_ENCRYPTION_KEY = [CEK_Auto1],
ENCRYPTION_TYPE = Deterministic,
ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256'))
const table = await conn.promises.getTable('test_encrpted_table')
const v =
[
{
field: 12345,
},
]
await table.promises.insert(v)
tables bound with numeric columns now encode correctly into ODBC rather than using doubles which had been case previously.
electron v22 binaries included
refactored table binding and stored procedures code.
Full Changelog: v3.0.0...v3.0.1
always on encryption
new promise to cancel a query from returned Query
it('use promise on query to cancel', async function handler () {
const conn = env.theConnection
const waitsql = env.waitForSql(20)
const q = conn.query(waitsql)
const err = await q.promises.cancel()
assert(err.message.includes('Operation canceled'))
})
new promise to call on a fetched procedure
await createProc(spName)
const msg = 'hello world'
const proc = await env.theConnection.promises.getProc(spName)
const res = await proc.promises.call({
param: msg
})
improved typings and JSDoc in index.d.ts - part 1 this will be continued in future releases, any contributions from TS typings experts very much welcome.
any changes must be compatible with current typescript test code
i.e. npm run build must compile
npm run build
> msnodesqlv8@3.0.0 build
> tsc
msnodesqlv8 git(master) node .\dist\samples\typescript\builder.js
IF OBJECT_ID('dbo.tmpTableBuilder', 'U') IS NOT NULL DROP TABLE dbo.tmpTableBuilder;
CREATE TABLE dbo.tmpTableBuilder ([id] int , [col_a] int NOT NULL, [col_b] varchar (100) NOT NULL, [col_c] int NOT NULL, [col_d] int NOT NULL, [col_e] varchar (100) NOT NULL)
[
{
"id": 0,
"col_a": 0,
"col_b": "str_0",
"col_c": 1,
"col_d": -1,
"col_e": "str2_0"
},
{
"id": 1,
"col_a": 5,
"col_b": "str_1",
"col_c": 2,
"col_d": 0,
"col_e": "str2_1"
},
{
"id": 2,
"col_a": 10,
"col_b": "str_2",
"col_c": 3,
"col_d": 1,
"col_e": "str2_2"
},
{
"id": 3,
"col_a": 15,
"col_b": "str_3",
"col_c": 4,
"col_d": 2,
"col_e": "str2_3"
},
{
"id": 4,
"col_a": 20,
"col_b": "str_4",
"col_c": 5,
"col_d": 3,
"col_e": "str2_4"
}
]
CREATE TYPE dbo.tmpTableBuilderType AS TABLE ([id] int , [col_a] int , [col_b] varchar (100) , [col_c] int , [col_d] int , [col_e] varchar (100) )
create or alter procedure dbo.tmpTableBuilder_tvp_inserter
(
@tvp dbo.tmpTableBuilderType READONLY
)
AS
BEGIN
set nocount on
INSERT INTO dbo.tmpTableBuilder
(
[id],
[col_a],
[col_b],
[col_c],
[col_d],
[col_e]
)
SELECT
[id],
[col_a],
[col_b],
[col_c],
[col_d],
[col_e]
n FROM @tvp tvp
END
id 0 equals true
id 1 equals true
id 2 equals true
id 3 equals true
id 4 equals true
done
always on encryption now working on stored proc and bound table calls - please see tests\encrypt.js
e.g with table below
CREATE TABLE node.dbo.test_encrpted_table (
[id] int IDENTITY(1,1) NOT NULL, [field] int ENCRYPTED WITH
(COLUMN_ENCRYPTION_KEY = [CEK_Auto1],
ENCRYPTION_TYPE = Deterministic,
ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256'))
const table = await conn.promises.getTable('test_encrpted_table')
const v =
[
{
field: 12345,
},
]
await table.promises.insert(v)
electron v22 binaries included