Closed jchrys closed 10 months ago
Hi @jchrys,
Do these interfaces need to be implemented anywhere or do they just need to be created? I think MySqlConnection has to implement Lifecycle. I don't think Wrapped needs to be implemented anywhere, it's up to the end user. Closeable might have to be implemented by MySqlConnectionFactory etc.
You're absolutely right. There is no need to implement the Wrapped
The MySqlConnection
should to do nothing in postAllocate
, only contains one job in preRelease
, which is to rollback if it is in a transaction.
Which means postAllocate
will return an empty Mono
, and preRelease
will be an alias as rollbackTransaction
.
Hmmm, I noticed that the COM_RESET_CONNECTION
command, which should be more suitable as preRelease
, it resets almost all state, including temporary tables, transactions, etc.
Forget it, it turns out that COM_RESET_CONNECTION
is not a good solution.
This command not being supported in 5.6.x and below, it will also cause all prepared statements to be cleared.
While implementing r2dbc-spi, the interface 'LifeCycle' is optional and not mandated by the specification. However, we believe it is important to provide support for this interface as it can benefit minority use cases. You can refer to this link for more information: https://r2dbc.io/spec/1.0.0.RELEASE/spec/html/#lifecycle.