mssqldriver
v1.0.1
Published
Driver for MS SQL Server, based on tediousjs
Downloads
5
Readme
mssqldriver
Driver for MS SQL Server, based on https://tediousjs.github.io/tedious
Features
- Receiving data in chunks or full
- Receiving spid
- Many queries in one connection
License
MIT
Install
npm i mssqldriver
Example
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)
}
})