Skip to content

Commit 7acf22c

Browse files
author
Andrey Sidorov
committed
WIP: pass encoding to writers and readers
1 parent ee9b2ad commit 7acf22c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/compile_binary_parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ function readCodeFor (field, config, options) {
132132
if (config.decimalNumbers) {
133133
return 'packet.parseLengthCodedFloat();';
134134
}
135-
return 'packet.readLengthCodedString();';
135+
return 'packet.readLengthCodedString("ascii");';
136136
case Types.GEOMETRY:
137137
return 'packet.parseGeometryValue();';
138138
case Types.JSON:
139-
return 'JSON.parse(packet.readLengthCodedString());';
139+
return 'JSON.parse(packet.readLengthCodedString("' + CharsetToEncoding[field.characterSet] + '"));';
140140
case Types.LONGLONG:
141141
if (!supportBigNumbers) {
142142
return unsigned ? 'packet.readInt64JSNumber();' : 'packet.readSInt64JSNumber();';

lib/connection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,14 +661,14 @@ Connection.prototype.writeColumns = function (columns) {
661661
var connection = this;
662662
this.writePacket(Packets.ResultSetHeader.toPacket(columns.length));
663663
columns.forEach(function (column) {
664-
connection.writePacket(Packets.ColumnDefinition.toPacket(column));
664+
connection.writePacket(Packets.ColumnDefinition.toPacket(column, this.serverConfig.encoding));
665665
});
666666
this.writeEof();
667667
};
668668

669669
// row is array of columns, not hash
670670
Connection.prototype.writeTextRow = function (column) {
671-
this.writePacket(Packets.TextRow.toPacket(column));
671+
this.writePacket(Packets.TextRow.toPacket(column, this.serverConfig.encoding));
672672
};
673673

674674
Connection.prototype.writeTextResult = function (rows, columns) {

0 commit comments

Comments
 (0)