-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for customizing transaction start - fixes #432 #640
Conversation
Signed-off-by: Billy Yuan <[email protected]>
@@ -62,9 +63,9 @@ | |||
} | |||
} | |||
|
|||
Future<Transaction> begin() { | |||
Future<Transaction> begin(String startTxSql) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startTxSql should be replace by an enum as each database might use something different to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also user don't want to know about the SQL for this :-)
Signed-off-by: Billy Yuan <[email protected]>
I have rethinked and add a prototype here(the code may be a little messy but it can show the basic design) The primary idea is to provide a simple API to configure transaction options at the start the transaction, and it would only support those common defined behaviors. Even though we have the same API, the sql to start a transaction in different databases is different, therefore we have to build the begin tx SQL at the codec level for different databases. If you're fine with this API, I will proceed to clean the code and work at this. |
LGTM. The ANSI standard options for the ANSI SQL also defines |
|
||
public static final TransactionOptions DEFAULT_TX_OPTIONS = new TransactionOptions(); | ||
|
||
private TransactionIsolationLevel transactionIsolationLevel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simply isolationLevel
public static final TransactionOptions DEFAULT_TX_OPTIONS = new TransactionOptions(); | ||
|
||
private TransactionIsolationLevel transactionIsolationLevel; | ||
private TransactionAccessMode transactionAccessMode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simply accessMode
public class StartTxCommand<R> extends TxCommand<R> { | ||
public TransactionOptions transactionOptions; | ||
|
||
public StartTxCommand(Kind kind, R result, TransactionOptions transactionOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather here directly the access mode and the isolation level as _ TransactionOptions_ is mutable
@@ -152,6 +153,14 @@ static Pool pool(Vertx vertx, SqlConnectOptions connectOptions, PoolOptions pool | |||
*/ | |||
<T> Future<T> withTransaction(Function<SqlClient, Future<T>> function); | |||
|
|||
@GenIgnore | |||
// FIXME codegen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the codegen error here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be ok, I just don't add codegen annotations for a POC prototype, will add it later
That makes some new classes in the top level package, I think we should have them in a |
Motivation:
fixes #432
Conformance:
Your commits should be signed and you should have signed the Eclipse Contributor Agreement as explained in https://github.com/eclipse/vert.x/blob/master/CONTRIBUTING.md
Please also make sure you adhere to the code style guidelines: https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines