mysql2 3.9.5 → 3.9.7
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.
|
@@ -42,9 +42,9 @@ function readCodeFor(field, config, options, fieldNum) {
|
|
|
42
42
|
case Types.TIMESTAMP:
|
|
43
43
|
case Types.NEWDATE:
|
|
44
44
|
if (helpers.typeMatch(field.columnType, dateStrings, Types)) {
|
|
45
|
-
return `packet.readDateTimeString(${field.decimals});`;
|
|
45
|
+
return `packet.readDateTimeString(${parseInt(field.decimals, 10)});`;
|
|
46
46
|
}
|
|
47
|
-
return `packet.readDateTime(
|
|
47
|
+
return `packet.readDateTime(${helpers.srcEscape(timezone)});`;
|
|
48
48
|
case Types.TIME:
|
|
49
49
|
return 'packet.readTimeString()';
|
|
50
50
|
case Types.DECIMAL:
|
|
@@ -169,6 +169,10 @@ function compile(fields, options, config) {
|
|
|
169
169
|
lvalue = `result[${fieldName}]`;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
parserFn(`if (nullBitmaskByte${nullByteIndex} & ${currentFieldNullBit}) `);
|
|
173
|
+
parserFn(`${lvalue} = null;`);
|
|
174
|
+
parserFn('else {');
|
|
175
|
+
|
|
172
176
|
if (options.typeCast === false) {
|
|
173
177
|
parserFn(`${lvalue} = packet.readLengthCodedBuffer();`);
|
|
174
178
|
} else {
|
|
@@ -176,9 +180,6 @@ function compile(fields, options, config) {
|
|
|
176
180
|
parserFn(`const ${fieldWrapperVar} = wrap(fields[${i}], packet);`);
|
|
177
181
|
const readCode = readCodeFor(fields[i], config, options, i);
|
|
178
182
|
|
|
179
|
-
parserFn(`if (nullBitmaskByte${nullByteIndex} & ${currentFieldNullBit})`);
|
|
180
|
-
parserFn(`${lvalue} = null;`);
|
|
181
|
-
parserFn('else {');
|
|
182
183
|
if (typeof options.typeCast === 'function') {
|
|
183
184
|
parserFn(
|
|
184
185
|
`${lvalue} = options.typeCast(${fieldWrapperVar}, function() { return ${readCode} });`,
|
|
@@ -186,8 +187,9 @@ function compile(fields, options, config) {
|
|
|
186
187
|
} else {
|
|
187
188
|
parserFn(`${lvalue} = ${readCode};`);
|
|
188
189
|
}
|
|
189
|
-
parserFn('}');
|
|
190
190
|
}
|
|
191
|
+
parserFn('}');
|
|
192
|
+
|
|
191
193
|
|
|
192
194
|
currentFieldNullBit *= 2;
|
|
193
195
|
if (currentFieldNullBit === 0x100) {
|
|
@@ -48,13 +48,13 @@ function readCodeFor(type, charset, encodingExpr, config, options) {
|
|
|
48
48
|
if (helpers.typeMatch(type, dateStrings, Types)) {
|
|
49
49
|
return 'packet.readLengthCodedString("ascii")';
|
|
50
50
|
}
|
|
51
|
-
return `packet.parseDate(
|
|
51
|
+
return `packet.parseDate(${helpers.srcEscape(timezone)})`;
|
|
52
52
|
case Types.DATETIME:
|
|
53
53
|
case Types.TIMESTAMP:
|
|
54
54
|
if (helpers.typeMatch(type, dateStrings, Types)) {
|
|
55
55
|
return 'packet.readLengthCodedString("ascii")';
|
|
56
56
|
}
|
|
57
|
-
return `packet.parseDateTime(
|
|
57
|
+
return `packet.parseDateTime(${helpers.srcEscape(timezone)})`;
|
|
58
58
|
case Types.TIME:
|
|
59
59
|
return 'packet.readLengthCodedString("ascii")';
|
|
60
60
|
case Types.GEOMETRY:
|
package/package.json
CHANGED