Skip to content

Commit 74637ae

Browse files
Update RowDataPacket.js
Make it possible for getting column by its index (just like field list). This way you can implement your own unique strategy outside the module. Usage: conn.query({ sql, nestTables: [] }, function(error, results, fields) { } );
1 parent 3430c51 commit 74637ae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/protocol/packets/RowDataPacket.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ function parse(parser, fieldPackets, typeCast, nestTables, connection) {
3939
: parser.parseLengthCodedString() );
4040
}
4141

42-
if (typeof nestTables === 'string' && nestTables.length) {
42+
if (Array.isArray(nestTables)) {
43+
this[i] = value;
44+
} else if (typeof nestTables === 'string' && nestTables.length) {
4345
this[fieldPacket.table + nestTables + fieldPacket.name] = value;
4446
} else if (nestTables) {
4547
this[fieldPacket.table] = this[fieldPacket.table] || {};

0 commit comments

Comments
 (0)