eclipse-vertx / vertx-sql-client

High performance reactive SQL Client written in Java
Apache License 2.0
894 stars 200 forks source link

Support for configuring transaction characteristics #432

Open jeoffreylim opened 5 years ago

jeoffreylim commented 5 years ago

Reference:

https://vertx.io/docs/apidocs/io/vertx/ext/sql/SQLOptions.html#getTransactionIsolation-- https://vertx.io/docs/apidocs/io/vertx/ext/sql/TransactionIsolation.html

vietj commented 4 years ago

this is somehow proprietary to each database, e.g for postgres one need to execute a SQL statement that will do that

BillyYccc commented 4 years ago

Yes it differs between different database vendors. Postgres supports starting a transaction with configuring transaction isolation levels and characteristics https://www.postgresql.org/docs/current/sql-start-transaction.html. MySQL supports starting a transaction with configuring only transaction characteristics(but additionally WITH CONSISTENT SNAPSHOT) https://dev.mysql.com/doc/refman/8.0/en/commit.html MS SQL Server does not support such kind of configuration syntax to start a transaction. https://docs.microsoft.com/en-us/sql/t-sql/language-elements/begin-transaction-transact-sql?view=sql-server-ver15

I'm thinking we might provide an API which seems like this

SqlConnection#begin(Supplier<String> startTxSql, Handler<AsyncResult<
Transaction>> handler);

so that users could be able to decide how the transactions are started.

On Thu, May 14, 2020 at 7:41 PM Julien Viet notifications@github.com wrote:

this is somehow proprietary to each database, e.g for postgres one need to execute a SQL statement that will do that

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/eclipse-vertx/vertx-sql-client/issues/432#issuecomment-628577616, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJV4JPDJWVC5CPTZ4XR7MDRRPKG3ANCNFSM4JADEB4Q .

vietj commented 4 years ago

+1

vietj commented 4 years ago

as part of the API I don't understand how the Supplier<String> startTxSql works

vietj commented 4 years ago

I think that the startTxSql should instead be replaced by an enum like the sql-common