scalikejdbc-async icon indicating copy to clipboard operation
scalikejdbc-async copied to clipboard

Support for setting isolation level for DB/DBConnection

Open KevinAtSesam opened this issue 5 years ago • 3 comments

Would it be interesting to implement a special pass-through parameter to set an isolation level for a transaction? Right now, it's possible to set an isolation level in scalikejdbc, but scalikejdbc-async misses this feature.

I haven't given much thought about the impact of this in an async setting, so please tell me if there are any unforeseen issues with such an addition.

Background details

  • Implementation in scalikejdbc
    • https://github.com/scalikejdbc/scalikejdbc/issues/442
  • Background info for databases
    • https://mariadb.com/kb/en/mariadb-transactions-and-isolation-levels-for-sql-server-users/
    • https://www.postgresql.org/docs/current/transaction-iso.html

KevinAtSesam avatar Oct 22 '20 08:10 KevinAtSesam

Hello, I think the feasibility to add the feature relies on the underlying library's support - https://github.com/jasync-sql/jasync-sql

I haven't checked yet but if the library provides a unified way to set an isolation level (probably no?), it should be relatively easy. If not, I think handling the differences among RDBMSs in this library is not a great idea.

seratch avatar Oct 22 '20 12:10 seratch

I already looked a bit into that a bit and right now, it looks like jasync-sql has nothing for it. It does pass the parameter on, but in no way does it facilitate anything:

Connection.kt#L20

You think it would be better to ask jasync-sql for support, and then come back here when they have something for it?

KevinAtSesam avatar Oct 22 '20 12:10 KevinAtSesam

Yeah, once they support it, I'm happy to add the feature to this library.

seratch avatar Oct 22 '20 13:10 seratch