@@ -94,7 +94,10 @@ class ConnectionPool extends Object with _ConnectionHelpers implements Queriable
94
94
_log.finest ("Logged in on cnx#${cnx .number }" );
95
95
c.complete (cnx);
96
96
} catch (e) {
97
- _releaseReuseCompleteError (cnx, c, e);
97
+ if (! (e is MySqlException )) {
98
+ _removeConnection (cnx);
99
+ }
100
+ c.completeError (e);
98
101
}
99
102
}
100
103
@@ -175,7 +178,6 @@ class ConnectionPool extends Object with _ConnectionHelpers implements Queriable
175
178
_log.info ("Running query: ${sql }" );
176
179
177
180
var cnx = await _getConnection ();
178
- var c = new Completer <Results >();
179
181
_log.fine ("Got cnx#${cnx .number } for query" );
180
182
try {
181
183
var results = await cnx.processHandler (new _QueryStreamHandler (sql));
@@ -269,15 +271,14 @@ class ConnectionPool extends Object with _ConnectionHelpers implements Queriable
269
271
270
272
var cnx = await _getConnection ();
271
273
cnx.inTransaction = true ;
272
- var c = new Completer <Transaction >();
273
274
var sql;
274
275
if (consistent) {
275
276
sql = "start transaction with consistent snapshot" ;
276
277
} else {
277
278
sql = "start transaction" ;
278
279
}
279
280
try {
280
- var results = await cnx.processHandler (new _QueryStreamHandler (sql));
281
+ await cnx.processHandler (new _QueryStreamHandler (sql));
281
282
_log.fine ("Transaction started on cnx#${cnx .number }" );
282
283
return new _TransactionImpl ._(cnx, this );
283
284
} catch (e) {
@@ -327,14 +328,6 @@ class ConnectionPool extends Object with _ConnectionHelpers implements Queriable
327
328
}
328
329
329
330
abstract class _ConnectionHelpers {
330
- _releaseReuseCompleteError (_Connection cnx, Completer c, dynamic e) {
331
- if (e is MySqlException ) {
332
- } else {
333
- _removeConnection (cnx);
334
- }
335
- c.completeError (e);
336
- }
337
-
338
331
_releaseReuseThrow (_Connection cnx, dynamic e) {
339
332
if (! (e is MySqlException )) {
340
333
_removeConnection (cnx);
0 commit comments