Driver for MS SQL Server, based on https://tediousjs.github.io/tedious
- Receiving data in chunks or full
- Receiving spid
- Many queries in one connection
MIT
npm i mssqldriver
import * as mssqldriver from 'mssqldriver'
const mssql = mssqldriver.Create({
authentication: 'sqlserver',
instance: 'myserver/myinstance',
login: 'sa',
password: '123'
})
mssql.exec([`print 'Hello'`, `select * from sys.columns`], {formatCells: 'string', hasSpid: true, receiveMessage: 'directly', receiveTables: 200}, callbackExec => {
if (callbackExec.kind === 'spid') {
console.log(`spid`, callbackExec.spid)
return
}
if (callbackExec.kind === 'message') {
console.log(`message`, callbackExec.message)
return
}
if (callbackExec.kind === 'columns') {
console.log(`columns (new table begin)`, callbackExec.columns)
return
}
if (callbackExec.kind === 'rows') {
console.log(`rows`, callbackExec.rows)
return
}
if (callbackExec.kind === 'finish') {
console.log(`finish`, callbackExec.finish)
}
})