Socket
Socket
Sign inDemoInstall

tedious

Package Overview
Dependencies
Maintainers
1
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tedious - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

lib/guid-parser.js

95

lib/data-type.js
// Generated by CoffeeScript 1.3.3
var EPOCH_DATE, MAX, NULL, TYPE, id, type, typeByName;
var EPOCH_DATE, MAX, NULL, TYPE, guidParser, id, type, typeByName;
guidParser = require('./guid-parser');
NULL = (1 << 16) - 1;

@@ -26,3 +28,3 @@

buffer.writeUInt8(1);
return buffer.writeInt8(parameter.value);
return buffer.writeInt8(parseInt(parameter.value));
} else {

@@ -61,3 +63,3 @@ return buffer.writeUInt8(0);

buffer.writeUInt8(2);
return buffer.writeInt16LE(parameter.value);
return buffer.writeInt16LE(parseInt(parameter.value));
} else {

@@ -79,3 +81,3 @@ return buffer.writeUInt8(0);

buffer.writeUInt8(4);
return buffer.writeInt32LE(parameter.value);
return buffer.writeInt32LE(parseInt(parameter.value));
} else {

@@ -111,2 +113,21 @@ return buffer.writeUInt8(0);

name: 'Real'
/*
declaration: (parameter) ->
'real'
writeParameterData: (buffer, parameter) ->
# ParamMetaData (TYPE_INFO)
# Some issues with rounding
buffer.writeUInt8(typeByName.FloatN.id)
buffer.writeUInt8(4)
# ParamLenData
if parameter.value?
buffer.writeUInt8(4)
buffer.writeFloatLE(parseFloat(parameter.value))
else
buffer.writeUInt8(0)
*/
},

@@ -146,3 +167,16 @@ 0x3C: {

type: 'FLT8',
name: 'Float'
name: 'Float',
declaration: function(parameter) {
return 'float';
},
writeParameterData: function(buffer, parameter) {
buffer.writeUInt8(typeByName.FloatN.id);
buffer.writeUInt8(8);
if (parameter.value != null) {
buffer.writeUInt8(8);
return buffer.writeDoubleLE(parseFloat(parameter.value));
} else {
return buffer.writeUInt8(0);
}
}
},

@@ -155,3 +189,21 @@ 0x7A: {

type: 'INT8',
name: 'BigInt'
name: 'BigInt',
declaration: function(parameter) {
return 'bigint';
},
writeParameterData: function(buffer, parameter) {
buffer.writeUInt8(typeByName.IntN.id);
buffer.writeUInt8(8);
if (parameter.value) {
buffer.writeUInt8(8);
if (parseInt(parameter.value) > 0x100000000) {
buffer.writeUInt32LE(parseInt(parameter.value) % 0x100000000);
} else {
buffer.writeInt32LE(parseInt(parameter.value) % 0x100000000);
}
return buffer.writeInt32LE(Math.floor(parseInt(parameter.value) / 0x100000000));
} else {
return buffer.writeUInt8(0);
}
}
},

@@ -176,3 +228,16 @@ 0x22: {

name: 'UniqueIdentifierN',
dataLengthLength: 1
dataLengthLength: 1,
declaration: function(parameter) {
return 'uniqueidentifier';
},
writeParameterData: function(buffer, parameter) {
buffer.writeUInt8(typeByName.UniqueIdentifierN.id);
buffer.writeUInt8(0x10);
if (parameter.value != null) {
buffer.writeUInt8(0x10);
return buffer.writeBuffer(new Buffer(guidParser.guidToArray(parameter.value)));
} else {
return buffer.writeUInt8(0);
}
}
},

@@ -242,3 +307,3 @@ 0x26: {

} else if (parameter.value != null) {
length = parameter.value.length;
length = parameter.value.toString().length;
} else {

@@ -258,3 +323,3 @@ length = this.maximumLength;

} else if (parameter.value != null) {
length = parameter.value.length;
length = parameter.value.toString().length;
} else {

@@ -273,7 +338,7 @@ length = this.maximumLength;

buffer.writeUInt16LE(length);
return buffer.writeString(parameter.value, 'ascii');
return buffer.writeString(parameter.value.toString(), 'ascii');
} else {
buffer.writeUInt64LE(length);
buffer.writeUInt32LE(length);
buffer.writeString(parameter.value, 'ascii');
buffer.writeString(parameter.value.toString(), 'ascii');
return buffer.writeUInt32LE(0);

@@ -308,3 +373,3 @@ }

} else if (parameter.value != null) {
length = 2 * parameter.value.length;
length = 2 * parameter.value.toString().length;
} else {

@@ -324,3 +389,3 @@ length = this.maximumLength;

} else if (parameter.value != null) {
length = 2 * parameter.value.length;
length = 2 * parameter.value.toString().length;
} else {

@@ -339,7 +404,7 @@ length = this.maximumLength;

buffer.writeUInt16LE(length);
return buffer.writeString(parameter.value, 'ucs2');
return buffer.writeString(parameter.value.toString(), 'ucs2');
} else {
buffer.writeUInt64LE(length);
buffer.writeUInt32LE(length);
buffer.writeString(parameter.value, 'ucs2');
buffer.writeString(parameter.value.toString(), 'ucs2');
return buffer.writeUInt32LE(0);

@@ -346,0 +411,0 @@ }

@@ -139,2 +139,18 @@ // Generated by CoffeeScript 1.3.3

WritableTrackingBuffer.prototype.writeFloatLE = function(value) {
var length;
length = 4;
this.makeRoomFor(length);
this.buffer.writeFloatLE(value, this.position);
return this.position += length;
};
WritableTrackingBuffer.prototype.writeDoubleLE = function(value) {
var length;
length = 8;
this.makeRoomFor(length);
this.buffer.writeDoubleLE(value, this.position);
return this.position += length;
};
WritableTrackingBuffer.prototype.writeString = function(value, encoding) {

@@ -141,0 +157,0 @@ var bytesWritten, length;

6

lib/value-parser.js
// Generated by CoffeeScript 1.3.3
var MAX, MONEY_DIVISOR, NULL, PLP_NULL, THREE_AND_A_THIRD, UNKNOWN_PLP_LEN, iconv, parse, readBinary, readChars, readDateTime, readMax, readMaxBinary, readMaxChars, readMaxNChars, readNChars, readSmallDateTime, sprintf;
var MAX, MONEY_DIVISOR, NULL, PLP_NULL, THREE_AND_A_THIRD, UNKNOWN_PLP_LEN, guidParser, iconv, parse, readBinary, readChars, readDateTime, readMax, readMaxBinary, readMaxChars, readMaxNChars, readNChars, readSmallDateTime, sprintf;

@@ -8,2 +8,4 @@ iconv = require('iconv-lite');

guidParser = require('./guid-parser');
require('./buffertools');

@@ -250,3 +252,3 @@

case 0x10:
value = buffer.readArray(0x10);
value = guidParser.arrayToGuid(buffer.readArray(0x10));
break;

@@ -253,0 +255,0 @@ default:

@@ -27,3 +27,3 @@ {

],
"version": "0.1.0",
"version": "0.1.1",
"main": "./lib/tedious.js",

@@ -30,0 +30,0 @@ "repository": {

@@ -14,3 +14,3 @@ Tedious (node implementation of TDS)

------
Current version: v0.0.7
Current version: v0.1.0

@@ -21,5 +21,4 @@ Coming soon

### v0.0.8 ###
- support for more data types for parameters
- support for varchar(max), nvarchar(max) and varbinary(max) as streams
- possible support for varchar(max), nvarchar(max) and varbinary(max) as streams

@@ -26,0 +25,0 @@ ### unplanned ###

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc