@@ -1973,20 +1973,36 @@ public ClickHouseResponse executeAndWait() throws ClickHouseException {
1973
1973
}
1974
1974
1975
1975
/**
1976
- * Executes the request within a transaction, wait until it's completed and
1977
- * the transaction being committed or rolled back. The transaction here is
1978
- * either an implicit transaction(using {@code implicit_transaction} server
1979
- * setting, with less overhead but requiring 22.7+) or auto-commit
1980
- * transaction(using clone of this request), depending on argument
1981
- * {@code useImplicitTransaction}.
1982
- *
1983
- * @param useImplicitTransaction use {@code implicit_transaction} server setting
1984
- * with minimum overhead(no session on server side
1985
- * and no additional objects on client side), or
1986
- * an auto-commit {@link ClickHouseTransaction}
1976
+ * Executes the request within an implicit transaction. New transaction will be
1977
+ * always created and started right before the query, and it will be committed
1978
+ * or rolled back afterwards automatically.
1979
+ *
1980
+ * @return non-null response
1981
+ * @throws ClickHouseException when error occurred during execution
1982
+ */
1983
+ public ClickHouseResponse executeWithinTransaction () throws ClickHouseException {
1984
+ return executeWithinTransaction (false );
1985
+ }
1986
+
1987
+ /**
1988
+ * Executes the request within an implicit transaction. When
1989
+ * {@code useImplicitTransaction} is set to {@code true}, it enforces the client
1990
+ * to use {@code implicit_transaction} setting which is only available in
1991
+ * ClickHouse 22.7+. Otherwise, new transaction will be always created and
1992
+ * started right before the query, and it will be committed or rolled back
1993
+ * afterwards automatically.
1994
+ *
1995
+ * @param useImplicitTransaction {@code true} to use native implicit transaction
1996
+ * requiring ClickHouse 22.7+ with minimum
1997
+ * overhead(no session on server side and no
1998
+ * additional objects on client side); false to
1999
+ * use auto-commit transaction
1987
2000
* @return non-null response
1988
2001
* @throws ClickHouseException when error occurred during execution
2002
+ * @deprecated will be removed in the future, once the minimum supported version
2003
+ * of ClickHouse is 22.7 or above
1989
2004
*/
2005
+ @ Deprecated
1990
2006
public ClickHouseResponse executeWithinTransaction (boolean useImplicitTransaction ) throws ClickHouseException {
1991
2007
if (useImplicitTransaction ) {
1992
2008
return set (ClickHouseTransaction .SETTING_IMPLICIT_TRANSACTION , 1 ).transaction (null ).executeAndWait ();
0 commit comments