@@ -7,11 +7,11 @@ const connectionHandler = require('./connectionHandler');
77const EVENTS = require ( './EVENTS.enum' ) ;
88const STATEMENTS = require ( './STATEMENTS.enum' ) ;
99
10+ /**
11+ * @param {Object|Connection|String } connection
12+ * @param {Object } options
13+ */
1014class MySQLEvents extends EventEmitter {
11- /**
12- * @param {Object|Connection|String } connection
13- * @param {Object } options
14- */
1515 constructor ( connection , options = { } ) {
1616 super ( ) ;
1717
@@ -88,7 +88,7 @@ class MySQLEvents extends EventEmitter {
8888 this . connection = await connectionHandler ( this . connection ) ;
8989
9090 debug ( 'initializing zongji' ) ;
91- this . zongJi = new ZongJi ( this . connection , Object . assign ( this . options , options ) ) ;
91+ this . zongJi = new ZongJi ( this . connection , Object . assign ( { } , this . options , options ) ) ;
9292
9393 debug ( 'connected' ) ;
9494 this . emit ( 'connected' ) ;
@@ -107,7 +107,7 @@ class MySQLEvents extends EventEmitter {
107107 debug ( 'disconnecting from mysql' ) ;
108108
109109 this . zongJi . stop ( ) ;
110- this . zongJi = null ;
110+ delete this . zongJi ;
111111
112112 await new Promise ( ( resolve , reject ) => {
113113 this . connection . end ( ( err ) => {
@@ -129,7 +129,6 @@ class MySQLEvents extends EventEmitter {
129129 if ( ! this . isStarted || this . isPaused ) return ;
130130 debug ( 'pausing connection' ) ;
131131
132- this . zongJi . ctrlConnection . pause ( ) ;
133132 this . zongJi . connection . pause ( ) ;
134133 this . isPaused = true ;
135134 this . emit ( EVENTS . PAUSED ) ;
@@ -142,7 +141,6 @@ class MySQLEvents extends EventEmitter {
142141 if ( ! this . isStarted || ! this . isPaused ) return ;
143142 debug ( 'resuming connection' ) ;
144143
145- this . zongJi . ctrlConnection . resume ( ) ;
146144 this . zongJi . connection . resume ( ) ;
147145 this . isPaused = false ;
148146 this . emit ( EVENTS . RESUMED ) ;
0 commit comments