Package Exports
- node-sql
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-sql) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-sql
A simple node-style callback wrapper for the wonderful Tedious driver.
var nodeSQL = require('node-sql')
//standard tedious config object : http://tediousjs.github.io/tedious/api-connection.html#function_newConnection
var config = {
userName: process.env.USERNAME,
password: process.env.PASSWORD,
server: 'MyServer',
domain: 'DOMAIN'
}
//result has data as an Array of JSON objects with column name => column value
app.get('/', function (req, res) {
nodeSQL.exec(`Select FirstName From tbl Where FirstName='Moshe'`, config, function(err, result){
if(err) res.status(500).json(err);
res.status(200).json(result);// [{FirstName: 'Moshe'}, {FirstName: 'Moshe'}]
});
})
Installation
$ npm install node-sql --save