@@ -13,6 +13,22 @@ Object.defineProperty(RowDataPacket.prototype, 'parse', {
13
13
value : parse
14
14
} ) ;
15
15
16
+ Object . defineProperty ( RowDataPacket . prototype , 'isArray' , {
17
+ configurable : true ,
18
+ enumerable : false ,
19
+ value : function ( ) {
20
+ return typeof this . _row !== 'undefined' ;
21
+ }
22
+ } ) ;
23
+
24
+ Object . defineProperty ( RowDataPacket . prototype , 'getArrayValue' , {
25
+ configurable : true ,
26
+ enumerable : false ,
27
+ value : function ( ) {
28
+ return this . _row ;
29
+ }
30
+ } ) ;
31
+
16
32
Object . defineProperty ( RowDataPacket . prototype , '_typeCast' , {
17
33
configurable : true ,
18
34
enumerable : false ,
@@ -25,6 +41,11 @@ function parse(parser, fieldPackets, typeCast, nestTables, connection) {
25
41
return self . _typeCast ( fieldPacket , parser , connection . config . timezone , connection . config . supportBigNumbers , connection . config . bigNumberStrings , connection . config . dateStrings ) ;
26
42
} ;
27
43
44
+ var isArrayRowMode = parser . isArrayRowMode ( ) ;
45
+ if ( isArrayRowMode ) {
46
+ this . _row = [ ] ;
47
+ }
48
+
28
49
for ( var i = 0 ; i < fieldPackets . length ; i ++ ) {
29
50
var fieldPacket = fieldPackets [ i ] ;
30
51
var value ;
@@ -39,7 +60,9 @@ function parse(parser, fieldPackets, typeCast, nestTables, connection) {
39
60
: parser . parseLengthCodedString ( ) ) ;
40
61
}
41
62
42
- if ( typeof nestTables === 'string' && nestTables . length ) {
63
+ if ( isArrayRowMode ) {
64
+ this . _row . push ( value ) ;
65
+ } else if ( typeof nestTables === 'string' && nestTables . length ) {
43
66
this [ fieldPacket . table + nestTables + fieldPacket . name ] = value ;
44
67
} else if ( nestTables ) {
45
68
this [ fieldPacket . table ] = this [ fieldPacket . table ] || { } ;
0 commit comments