tedious 2.2.2 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/bulk-load.js +1 -1
- package/lib/connection.js +149 -132
- package/lib/data-type.js +147 -1684
- package/lib/data-types/bigint.js +46 -0
- package/lib/data-types/binary.js +57 -0
- package/lib/data-types/bit.js +38 -0
- package/lib/data-types/bitn.js +8 -0
- package/lib/data-types/char.js +72 -0
- package/lib/data-types/date.js +47 -0
- package/lib/data-types/datetime.js +68 -0
- package/lib/data-types/datetime2.js +104 -0
- package/lib/data-types/datetimen.js +8 -0
- package/lib/data-types/datetimeoffset.js +90 -0
- package/lib/data-types/decimal.js +88 -0
- package/lib/data-types/decimaln.js +10 -0
- package/lib/data-types/float.js +38 -0
- package/lib/data-types/floatn.js +8 -0
- package/lib/data-types/image.js +46 -0
- package/lib/data-types/int.js +41 -0
- package/lib/data-types/intn.js +8 -0
- package/lib/data-types/money.js +38 -0
- package/lib/data-types/moneyn.js +8 -0
- package/lib/data-types/nchar.js +72 -0
- package/lib/data-types/ntext.js +11 -0
- package/lib/data-types/null.js +7 -0
- package/lib/data-types/numeric.js +88 -0
- package/lib/data-types/numericn.js +10 -0
- package/lib/data-types/nvarchar.js +86 -0
- package/lib/data-types/real.js +38 -0
- package/lib/data-types/smalldatetime.js +60 -0
- package/lib/data-types/smallint.js +41 -0
- package/lib/data-types/smallmoney.js +41 -0
- package/lib/data-types/sql-variant.js +12 -0
- package/lib/data-types/text.js +51 -0
- package/lib/data-types/time.js +94 -0
- package/lib/data-types/tinyint.js +41 -0
- package/lib/data-types/tvp.js +83 -0
- package/lib/data-types/udt.js +8 -0
- package/lib/data-types/uniqueidentifier.js +45 -0
- package/lib/data-types/varbinary.js +77 -0
- package/lib/data-types/varchar.js +86 -0
- package/lib/data-types/xml.js +8 -0
- package/lib/instance-lookup.js +8 -7
- package/lib/message-io.js +1 -1
- package/lib/packet.js +2 -2
- package/lib/prelogin-payload.js +6 -6
- package/lib/request.js +14 -10
- package/lib/tracking-buffer/writable-tracking-buffer.js +29 -31
- package/lib/value-parser.js +5 -5
- package/package.json +5 -7
|
@@ -44,7 +44,7 @@ module.exports = function () {
|
|
|
44
44
|
var length = buffer.length;
|
|
45
45
|
this.makeRoomFor(length);
|
|
46
46
|
buffer.copy(this.buffer, this.position);
|
|
47
|
-
|
|
47
|
+
this.position += length;
|
|
48
48
|
}
|
|
49
49
|
}, {
|
|
50
50
|
key: 'makeRoomFor',
|
|
@@ -55,9 +55,9 @@ module.exports = function () {
|
|
|
55
55
|
while (size < requiredLength) {
|
|
56
56
|
size *= 2;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
this.newBuffer(size);
|
|
59
59
|
} else {
|
|
60
|
-
|
|
60
|
+
this.newBuffer(requiredLength);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -67,7 +67,7 @@ module.exports = function () {
|
|
|
67
67
|
var buffer = this.buffer.slice(0, this.position);
|
|
68
68
|
this.compositeBuffer = Buffer.concat([this.compositeBuffer, buffer]);
|
|
69
69
|
this.buffer = size === 0 ? ZERO_LENGTH_BUFFER : new Buffer(size).fill(0);
|
|
70
|
-
|
|
70
|
+
this.position = 0;
|
|
71
71
|
}
|
|
72
72
|
}, {
|
|
73
73
|
key: 'writeUInt8',
|
|
@@ -75,7 +75,7 @@ module.exports = function () {
|
|
|
75
75
|
var length = 1;
|
|
76
76
|
this.makeRoomFor(length);
|
|
77
77
|
this.buffer.writeUInt8(value, this.position);
|
|
78
|
-
|
|
78
|
+
this.position += length;
|
|
79
79
|
}
|
|
80
80
|
}, {
|
|
81
81
|
key: 'writeUInt16LE',
|
|
@@ -83,12 +83,12 @@ module.exports = function () {
|
|
|
83
83
|
var length = 2;
|
|
84
84
|
this.makeRoomFor(length);
|
|
85
85
|
this.buffer.writeUInt16LE(value, this.position);
|
|
86
|
-
|
|
86
|
+
this.position += length;
|
|
87
87
|
}
|
|
88
88
|
}, {
|
|
89
89
|
key: 'writeUShort',
|
|
90
90
|
value: function writeUShort(value) {
|
|
91
|
-
|
|
91
|
+
this.writeUInt16LE(value);
|
|
92
92
|
}
|
|
93
93
|
}, {
|
|
94
94
|
key: 'writeUInt16BE',
|
|
@@ -96,7 +96,7 @@ module.exports = function () {
|
|
|
96
96
|
var length = 2;
|
|
97
97
|
this.makeRoomFor(length);
|
|
98
98
|
this.buffer.writeUInt16BE(value, this.position);
|
|
99
|
-
|
|
99
|
+
this.position += length;
|
|
100
100
|
}
|
|
101
101
|
}, {
|
|
102
102
|
key: 'writeUInt24LE',
|
|
@@ -106,7 +106,7 @@ module.exports = function () {
|
|
|
106
106
|
this.buffer[this.position + 2] = value >>> 16 & 0xff;
|
|
107
107
|
this.buffer[this.position + 1] = value >>> 8 & 0xff;
|
|
108
108
|
this.buffer[this.position] = value & 0xff;
|
|
109
|
-
|
|
109
|
+
this.position += length;
|
|
110
110
|
}
|
|
111
111
|
}, {
|
|
112
112
|
key: 'writeUInt32LE',
|
|
@@ -114,13 +114,13 @@ module.exports = function () {
|
|
|
114
114
|
var length = 4;
|
|
115
115
|
this.makeRoomFor(length);
|
|
116
116
|
this.buffer.writeUInt32LE(value, this.position);
|
|
117
|
-
|
|
117
|
+
this.position += length;
|
|
118
118
|
}
|
|
119
119
|
}, {
|
|
120
120
|
key: 'writeInt64LE',
|
|
121
121
|
value: function writeInt64LE(value) {
|
|
122
122
|
var buf = bigint.numberToInt64LE(value);
|
|
123
|
-
|
|
123
|
+
this.copyFrom(buf);
|
|
124
124
|
}
|
|
125
125
|
}, {
|
|
126
126
|
key: 'writeUInt32BE',
|
|
@@ -128,20 +128,20 @@ module.exports = function () {
|
|
|
128
128
|
var length = 4;
|
|
129
129
|
this.makeRoomFor(length);
|
|
130
130
|
this.buffer.writeUInt32BE(value, this.position);
|
|
131
|
-
|
|
131
|
+
this.position += length;
|
|
132
132
|
}
|
|
133
133
|
}, {
|
|
134
134
|
key: 'writeUInt40LE',
|
|
135
135
|
value: function writeUInt40LE(value) {
|
|
136
136
|
// inspired by https://github.com/dpw/node-buffer-more-ints
|
|
137
137
|
this.writeInt32LE(value & -1);
|
|
138
|
-
|
|
138
|
+
this.writeUInt8(Math.floor(value * SHIFT_RIGHT_32));
|
|
139
139
|
}
|
|
140
140
|
}, {
|
|
141
141
|
key: 'writeUInt64LE',
|
|
142
142
|
value: function writeUInt64LE(value) {
|
|
143
143
|
this.writeInt32LE(value & -1);
|
|
144
|
-
|
|
144
|
+
this.writeUInt32LE(Math.floor(value * SHIFT_RIGHT_32));
|
|
145
145
|
}
|
|
146
146
|
}, {
|
|
147
147
|
key: 'writeInt8',
|
|
@@ -149,7 +149,7 @@ module.exports = function () {
|
|
|
149
149
|
var length = 1;
|
|
150
150
|
this.makeRoomFor(length);
|
|
151
151
|
this.buffer.writeInt8(value, this.position);
|
|
152
|
-
|
|
152
|
+
this.position += length;
|
|
153
153
|
}
|
|
154
154
|
}, {
|
|
155
155
|
key: 'writeInt16LE',
|
|
@@ -157,7 +157,7 @@ module.exports = function () {
|
|
|
157
157
|
var length = 2;
|
|
158
158
|
this.makeRoomFor(length);
|
|
159
159
|
this.buffer.writeInt16LE(value, this.position);
|
|
160
|
-
|
|
160
|
+
this.position += length;
|
|
161
161
|
}
|
|
162
162
|
}, {
|
|
163
163
|
key: 'writeInt16BE',
|
|
@@ -165,7 +165,7 @@ module.exports = function () {
|
|
|
165
165
|
var length = 2;
|
|
166
166
|
this.makeRoomFor(length);
|
|
167
167
|
this.buffer.writeInt16BE(value, this.position);
|
|
168
|
-
|
|
168
|
+
this.position += length;
|
|
169
169
|
}
|
|
170
170
|
}, {
|
|
171
171
|
key: 'writeInt32LE',
|
|
@@ -173,7 +173,7 @@ module.exports = function () {
|
|
|
173
173
|
var length = 4;
|
|
174
174
|
this.makeRoomFor(length);
|
|
175
175
|
this.buffer.writeInt32LE(value, this.position);
|
|
176
|
-
|
|
176
|
+
this.position += length;
|
|
177
177
|
}
|
|
178
178
|
}, {
|
|
179
179
|
key: 'writeInt32BE',
|
|
@@ -181,7 +181,7 @@ module.exports = function () {
|
|
|
181
181
|
var length = 4;
|
|
182
182
|
this.makeRoomFor(length);
|
|
183
183
|
this.buffer.writeInt32BE(value, this.position);
|
|
184
|
-
|
|
184
|
+
this.position += length;
|
|
185
185
|
}
|
|
186
186
|
}, {
|
|
187
187
|
key: 'writeFloatLE',
|
|
@@ -189,7 +189,7 @@ module.exports = function () {
|
|
|
189
189
|
var length = 4;
|
|
190
190
|
this.makeRoomFor(length);
|
|
191
191
|
this.buffer.writeFloatLE(value, this.position);
|
|
192
|
-
|
|
192
|
+
this.position += length;
|
|
193
193
|
}
|
|
194
194
|
}, {
|
|
195
195
|
key: 'writeDoubleLE',
|
|
@@ -197,7 +197,7 @@ module.exports = function () {
|
|
|
197
197
|
var length = 8;
|
|
198
198
|
this.makeRoomFor(length);
|
|
199
199
|
this.buffer.writeDoubleLE(value, this.position);
|
|
200
|
-
|
|
200
|
+
this.position += length;
|
|
201
201
|
}
|
|
202
202
|
}, {
|
|
203
203
|
key: 'writeString',
|
|
@@ -210,22 +210,20 @@ module.exports = function () {
|
|
|
210
210
|
this.makeRoomFor(length);
|
|
211
211
|
|
|
212
212
|
// $FlowFixMe https://github.com/facebook/flow/pull/5398
|
|
213
|
-
|
|
213
|
+
this.buffer.write(value, this.position, encoding);
|
|
214
214
|
this.position += length;
|
|
215
|
-
|
|
216
|
-
return bytesWritten;
|
|
217
215
|
}
|
|
218
216
|
}, {
|
|
219
217
|
key: 'writeBVarchar',
|
|
220
218
|
value: function writeBVarchar(value, encoding) {
|
|
221
219
|
this.writeUInt8(value.length);
|
|
222
|
-
|
|
220
|
+
this.writeString(value, encoding);
|
|
223
221
|
}
|
|
224
222
|
}, {
|
|
225
223
|
key: 'writeUsVarchar',
|
|
226
224
|
value: function writeUsVarchar(value, encoding) {
|
|
227
225
|
this.writeUInt16LE(value.length);
|
|
228
|
-
|
|
226
|
+
this.writeString(value, encoding);
|
|
229
227
|
}
|
|
230
228
|
|
|
231
229
|
// TODO: Figure out what types are passed in other than `Buffer`
|
|
@@ -247,12 +245,12 @@ module.exports = function () {
|
|
|
247
245
|
this.writeUInt16LE(length);
|
|
248
246
|
|
|
249
247
|
if (value instanceof Buffer) {
|
|
250
|
-
|
|
248
|
+
this.writeBuffer(value);
|
|
251
249
|
} else {
|
|
252
250
|
this.makeRoomFor(length);
|
|
253
251
|
// $FlowFixMe https://github.com/facebook/flow/pull/5398
|
|
254
252
|
this.buffer.write(value, this.position, encoding);
|
|
255
|
-
|
|
253
|
+
this.position += length;
|
|
256
254
|
}
|
|
257
255
|
}
|
|
258
256
|
}, {
|
|
@@ -290,7 +288,7 @@ module.exports = function () {
|
|
|
290
288
|
}
|
|
291
289
|
|
|
292
290
|
// PLP_TERMINATOR (no more chunks).
|
|
293
|
-
|
|
291
|
+
this.writeUInt32LE(0);
|
|
294
292
|
}
|
|
295
293
|
}, {
|
|
296
294
|
key: 'writeBuffer',
|
|
@@ -298,13 +296,13 @@ module.exports = function () {
|
|
|
298
296
|
var length = value.length;
|
|
299
297
|
this.makeRoomFor(length);
|
|
300
298
|
value.copy(this.buffer, this.position);
|
|
301
|
-
|
|
299
|
+
this.position += length;
|
|
302
300
|
}
|
|
303
301
|
}, {
|
|
304
302
|
key: 'writeMoney',
|
|
305
303
|
value: function writeMoney(value) {
|
|
306
304
|
this.writeInt32LE(Math.floor(value * SHIFT_RIGHT_32));
|
|
307
|
-
|
|
305
|
+
this.writeInt32LE(value & -1);
|
|
308
306
|
}
|
|
309
307
|
}, {
|
|
310
308
|
key: 'data',
|
package/lib/value-parser.js
CHANGED
|
@@ -244,28 +244,28 @@ function valueParse(parser, metaData, options, callback) {
|
|
|
244
244
|
return readDateTime(parser, options.useUTC, callback);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
case '
|
|
247
|
+
case 'Time':
|
|
248
248
|
if (dataLength === 0) {
|
|
249
249
|
return callback(null);
|
|
250
250
|
} else {
|
|
251
251
|
return readTime(parser, dataLength, metaData.scale, options.useUTC, callback);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
case '
|
|
254
|
+
case 'Date':
|
|
255
255
|
if (dataLength === 0) {
|
|
256
256
|
return callback(null);
|
|
257
257
|
} else {
|
|
258
258
|
return readDate(parser, options.useUTC, callback);
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
case '
|
|
261
|
+
case 'DateTime2':
|
|
262
262
|
if (dataLength === 0) {
|
|
263
263
|
return callback(null);
|
|
264
264
|
} else {
|
|
265
265
|
return readDateTime2(parser, dataLength, metaData.scale, options.useUTC, callback);
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
case '
|
|
268
|
+
case 'DateTimeOffset':
|
|
269
269
|
if (dataLength === 0) {
|
|
270
270
|
return callback(null);
|
|
271
271
|
} else {
|
|
@@ -304,7 +304,7 @@ function valueParse(parser, metaData, options, callback) {
|
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
case '
|
|
307
|
+
case 'UniqueIdentifier':
|
|
308
308
|
switch (dataLength) {
|
|
309
309
|
case 0:
|
|
310
310
|
return callback(null);
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"homepage": "https://github.com/tediousjs/tedious",
|
|
28
28
|
"bugs": "https://github.com/tediousjs/tedious/issues",
|
|
29
29
|
"license": "MIT",
|
|
30
|
-
"version": "2.
|
|
30
|
+
"version": "2.3.1",
|
|
31
31
|
"main": "./lib/tedious.js",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"babel-runtime": "^6.26.0",
|
|
44
44
|
"big-number": "0.3.1",
|
|
45
45
|
"bl": "^1.2.0",
|
|
46
|
+
"depd": "^1.1.2",
|
|
46
47
|
"iconv-lite": "^0.4.11",
|
|
47
48
|
"readable-stream": "^2.2.6",
|
|
48
49
|
"sprintf": "0.1.5"
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"mitm": "^1.3.2",
|
|
62
63
|
"nodeunit": "^0.11.0",
|
|
63
64
|
"rimraf": "^2.6.1",
|
|
64
|
-
"semantic-release": "^
|
|
65
|
+
"semantic-release": "^12.2.5",
|
|
65
66
|
"sinon": "^1.17.5"
|
|
66
67
|
},
|
|
67
68
|
"scripts": {
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"test-all": "nodeunit --reporter minimal test/setup.js test/unit/ test/unit/token/ test/unit/tracking-buffer test/integration/",
|
|
72
73
|
"build": "rimraf lib && babel src --out-dir lib",
|
|
73
74
|
"prepublish": "npm run build",
|
|
74
|
-
"semantic-release": "semantic-release
|
|
75
|
+
"semantic-release": "semantic-release"
|
|
75
76
|
},
|
|
76
77
|
"babel": {
|
|
77
78
|
"presets": [
|
|
@@ -88,8 +89,5 @@
|
|
|
88
89
|
"plugins": [
|
|
89
90
|
"transform-runtime"
|
|
90
91
|
]
|
|
91
|
-
},
|
|
92
|
-
"release": {
|
|
93
|
-
"verifyConditions": "semantic-release/src/lib/plugin-noop"
|
|
94
92
|
}
|
|
95
|
-
}
|
|
93
|
+
}
|