Comparing version 0.0.1 to 0.0.2
var Connection = require('../lib/tedious').Connection; | ||
var Request = require('../lib/tedious').Request; | ||
var options = {}; | ||
var config = { | ||
server: '192.168.1.210', | ||
userName: 'test', | ||
password: 'test' | ||
/* | ||
,options: { | ||
debug: { | ||
packet: true, | ||
data: true, | ||
payload: true, | ||
token: false, | ||
log: true | ||
} | ||
} | ||
*/ | ||
}; | ||
var connection = new Connection('192.168.1.210', 'test', 'test', options, | ||
function(err, loggedIn) { | ||
var connection = new Connection(config); | ||
connection.on('connect', function(err) { | ||
// If no error, then good to go... | ||
executeStatement() | ||
executeStatement(); | ||
} | ||
) | ||
); | ||
connection.on('debug', function(text) { | ||
//console.log(text); | ||
} | ||
); | ||
function executeStatement() { | ||
request = new Request("select 42, 'hello world'", function(err, rowCount) { | ||
console.log(rowCount + ' rows returned'); | ||
request = new Request("select 42, 'hello world'", function(err) { | ||
connection.close(); | ||
}); | ||
@@ -20,3 +41,3 @@ | ||
columns.forEach(function(column) { | ||
if (column.isNull) { | ||
if (column.value === null) { | ||
console.log('NULL'); | ||
@@ -29,3 +50,7 @@ } else { | ||
request.on('done', function(rowCount, more) { | ||
console.log(rowCount + ' rows returned'); | ||
}); | ||
connection.execSql(request); | ||
} |
@@ -12,14 +12,15 @@ var Connection = require('../lib/tedious').Connection; | ||
token: false, | ||
packet: true | ||
packet: true, | ||
log: true | ||
} | ||
var connection = new Connection(config.server, config.userName, config.password, config.options, connected); | ||
var connection = new Connection(config); | ||
connection.on('connect', connected); | ||
connection.on('infoMessage', infoError); | ||
connection.on('errorMessage', infoError); | ||
connection.on('timeout', timeout); | ||
connection.on('closed', closed); | ||
connection.on('end', end); | ||
connection.on('debug', debug); | ||
function connected(err, loggedIn) { | ||
function connected(err) { | ||
if (err) { | ||
@@ -48,3 +49,4 @@ console.log(err); | ||
request.on('columnMetadata', columnMetadata); | ||
request.on('row', row); | ||
request.on('row', row); | ||
request.on('done', requestDone); | ||
@@ -54,11 +56,13 @@ connection.execSql(request); | ||
function statementComplete(err, rowCount) { | ||
function requestDone(rowCount, more) { | ||
console.log(rowCount + ' rows'); | ||
} | ||
function statementComplete(err) { | ||
if (err) { | ||
//console.log('Statement failed: ' + err); | ||
} else { | ||
console.log(rowCount + ' rows'); | ||
} | ||
} | ||
function closed() { | ||
function end() { | ||
console.log('Connection closed'); | ||
@@ -68,6 +72,2 @@ process.exit(0); | ||
function timeout() { | ||
console.log('Connection timeout'); | ||
} | ||
function infoError(info) { | ||
@@ -78,3 +78,3 @@ console.log(info.number + ' : ' + info.message); | ||
function debug(message) { | ||
console.log(message); | ||
//console.log(message); | ||
} | ||
@@ -92,3 +92,3 @@ | ||
columns.forEach(function(column) { | ||
if (column.isNull) { | ||
if (column.value === null) { | ||
value = 'NULL'; | ||
@@ -104,54 +104,1 @@ } else { | ||
} | ||
// test.strictEqual(columnsMetadata.length, 3) | ||
// ) | ||
// | ||
// connection.on('row', (columns) -> | ||
// connection.on('databaseChange', (database) -> | ||
// test.strictEqual(database, config.options.database) | ||
// ) | ||
// | ||
// connection.on('debug', (message) -> | ||
// #console.log(message) | ||
// ) | ||
// | ||
// exports.execSimpleSql = (test) -> | ||
// test.expect(15) | ||
// | ||
// connection = new Connection(config.server, config.userName, config.password, config.options, (err, loggedIn) -> | ||
// test.ok(!err) | ||
// test.ok(loggedIn) | ||
// | ||
// connection.execSql("select 8 as C1, 'abc' as C2, N'def' as C3", (err, rowCount) -> | ||
// test.ok(!err) | ||
// test.strictEqual(rowCount, 1) | ||
// test.done() | ||
// ) | ||
// ) | ||
// | ||
// connection.on('columnMetadata', (columnsMetadata) -> | ||
// test.strictEqual(columnsMetadata.length, 3) | ||
// ) | ||
// | ||
// connection.on('row', (columns) -> | ||
// test.strictEqual(columns.length, 3) | ||
// | ||
// test.strictEqual(columns[0].value, 8) | ||
// test.strictEqual(columns[1].value, 'abc') | ||
// test.strictEqual(columns[2].value, 'def') | ||
// | ||
// test.strictEqual(columns[0].isNull, false) | ||
// test.strictEqual(columns[1].isNull, false) | ||
// test.strictEqual(columns[2].isNull, false) | ||
// | ||
// byName = columns.byName() | ||
// test.strictEqual(byName.C1.value, 8) | ||
// test.strictEqual(byName.C2.value, 'abc') | ||
// test.strictEqual(byName.C3.value, 'def') | ||
// ) | ||
// | ||
// connection.on('debug', (message) -> | ||
// #console.log(message) | ||
// ) | ||
require('coffee-script') | ||
exports.statemachineLogLevel = 0 | ||
exports.Connection = require('./connection') | ||
exports.Request = require('./request') | ||
exports.library = require('./library') |
{ | ||
"author": "Mike D Pilsbury <mike.pilsbury@gmail.com>", | ||
"contributors": [ | ||
"Ciaran Jessup <ciaranj@gmail.com>" | ||
], | ||
"name": "tedious", | ||
"description": "A TDS driver, for connecting to MS SQLServer databases.", | ||
"homepage": "https://github.com/pekim/tedious", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main" : "./lib/tedious.js", | ||
"repository": { | ||
@@ -15,3 +19,2 @@ "type": "git", | ||
"dependencies": { | ||
"buffertools": "1.0.5", | ||
"coffee-script": "1.1.3", | ||
@@ -18,0 +21,0 @@ "sprintf": "0.1.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
2
2
227957
72
131
- Removedbuffertools@1.0.5
- Removedbuffertools@1.0.5(transitive)