Skip to content

Commit 6d14543

Browse files
committed
use packet methods in buffer and geom parsers
1 parent 6d0bb6f commit 6d14543

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

lib/compile_text_parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function compile (fields, options, config) {
2121
table: field.table,
2222
name: field.name,
2323
string: function() { return packet.readLengthCodedString(); },
24-
buffer: function () { return this.parser.parseLengthCodedBuffer(); },
25-
geometry: function () { return this.parser.parseGeometryValue(); }
24+
buffer: function () { return packet.parseLengthCodedBuffer(); },
25+
geometry: function () { return packet.parseGeometryValue(); }
2626
};
2727
};
2828

test/integration/connection/test-typecast-geometry.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,14 @@ var assert = require('assert');
55
connection.query({
66
sql: 'select GeomFromText(\'POINT(11 0)\') as foo',
77
typeCast: function (field, next) {
8-
if (field.type == 'GEOMETRY') {
8+
if (field.type === 'GEOMETRY') {
99
return field.geometry();
1010
}
1111
return next();
1212
}
1313
}, function(err, res) {
1414
assert.ifError(err);
15-
assert(Buffer.isBuffer(res[0].foo));
16-
});
17-
18-
19-
connection.query({
20-
sql: 'select GeomFromText(\'POINT(11 0)\') as foo',
21-
typeCast: false
22-
}, function(err, res) {
23-
assert.ifError(err);
24-
assert(Buffer.isBuffer(res[0].foo));
15+
assert.deepEqual(res[0].foo, { x: 11, y: 0 });
2516
});
2617

2718
connection.end();

0 commit comments

Comments
 (0)