This code assumes it will get same connection in future callback (cnx), that it sent into _waitUntilReady:
_waitUntilReady(cnx).then((_) {
_log.finest("Connection ready - closing query: ${q.sql}");
var handler = new _CloseStatementHandler(preparedQuery.statementHandlerId);
cnx.autoRelease = !retain;
cnx.processHandler(handler, noResponse: true);
});
but it gets another object (_), that has different data. In my case cnx._handler is not empty, so processHandler throws exception. But after _finishAndReuse (before future callback) _._handler becomes null and the state of _ is more likely ready for closing prepared query. So I would use _ in callback rather cnx.
I can send a pull request if I am right and there must _ instead of cnx.
This code assumes it will get same connection in future callback (
cnx
), that it sent into_waitUntilReady
:but it gets another object (
_
), that has different data. In my casecnx._handler
is not empty, so processHandler throws exception. But after_finishAndReuse
(before future callback)_._handler
becomes null and the state of_
is more likely ready for closing prepared query. So I would use_
in callback rathercnx
. I can send a pull request if I am right and there must_
instead ofcnx
.