Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2025 DBeaver Corp and others
* Copyright (C) 2010-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,6 +35,8 @@
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.connection.DBPDriverConstants;
import org.jkiss.dbeaver.model.data.*;
import org.jkiss.dbeaver.model.edit.DBEPersistAction;
import org.jkiss.dbeaver.model.exec.*;
Expand Down Expand Up @@ -415,13 +417,17 @@ public WebSQLExecuteInfo updateResultsDataBatch(
monitor, resultsInfo, rowIdentifier, updatedRows, deletedRows, addedRows, resultBatches, keyReceiver);

DBCExecutionContext executionContext = getExecutionContext(dataManipulator);
DBPDriver driver = executionContext.getDataSource().getContainer().getDriver();
boolean skipAutoCommitToggle = CommonUtils.toBoolean(
driver.getDriverParameter(DBPDriverConstants.PARAM_NATIVE_BATCH_AUTO_COMMIT)
);
try (DBCSession session = executionContext.openSession(monitor, DBCExecutionPurpose.USER, "Update data in container")) {
DBCTransactionManager txnManager = DBUtils.getTransactionManager(executionContext);
boolean revertToAutoCommit = false;
DBCSavepoint savepoint = null;
if (txnManager != null) {
isAutoCommitEnabled = txnManager.isAutoCommit();
if (txnManager.isSupportsTransactions() && isAutoCommitEnabled) {
if (txnManager.isSupportsTransactions() && isAutoCommitEnabled && !skipAutoCommitToggle) {
txnManager.setAutoCommit(monitor, false);
revertToAutoCommit = true;
}
Expand All @@ -447,11 +453,13 @@ public WebSQLExecuteInfo updateResultsDataBatch(
newResultSetRows.add(new WebSQLQueryResultSetRow(rowValues, null));
}

if (txnManager != null && txnManager.isSupportsTransactions() && isAutoCommitEnabled) {
if (txnManager != null && txnManager.isSupportsTransactions() &&
isAutoCommitEnabled && !skipAutoCommitToggle
) {
txnManager.commit(session);
}
} catch (Exception e) {
if (txnManager != null && txnManager.isSupportsTransactions()) {
if (txnManager != null && txnManager.isSupportsTransactions() && !skipAutoCommitToggle) {
Comment thread
Nexus6v2 marked this conversation as resolved.
txnManager.rollback(session, savepoint);
}
throw new DBCException("Error persisting data changes", e);
Expand Down
Loading