dbeaver/pro#7693 added key attributes row id check (#4019)

* dbeaver/pro#7693 added key attributes row id check

* dbeaver/pro#7693 added fix for single row tables

---------

Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com>
This commit is contained in:
Dmitrii Barnukov
2025-12-29 12:35:47 +01:00
committed by GitHub
co-authored by Daria Marutkina
parent c39de17df8
commit 7a12ad4b91
@@ -951,7 +951,7 @@ public class WebSQLProcessor implements WebSessionProvider {
DBCExecutionContext executionContext = getExecutionContext(dataContainer);
try (DBCSession session = executionContext.openSession(monitor, DBCExecutionPurpose.USER, "Generate data update batches")) {
DBDDataFilter dataFilter = new DBDDataFilter();
addKeyAttributes(resultsInfo, row, dataContainer, session, dataFilter);
addKeyAttributes(monitor, resultsInfo, row, dataContainer, session, dataFilter);
WebExecutionSource executionSource = new WebExecutionSource(dataContainer, executionContext, this);
dataContainer.readData(
executionSource, session, dataReceiver, dataFilter,
@@ -960,16 +960,21 @@ public class WebSQLProcessor implements WebSessionProvider {
}
private void addKeyAttributes(
@NotNull DBRProgressMonitor monitor,
@NotNull WebSQLResultsInfo resultsInfo,
@NotNull WebSQLResultsRow row,
@NotNull DBSDataContainer dataContainer,
@NotNull DBCSession session,
@NotNull DBDDataFilter dataFilter
) throws DBException {
DBDRowIdentifier rowIdentifier = resultsInfo.getDefaultRowIdentifier();
if (rowIdentifier == null || rowIdentifier.isIncomplete()) {
return;
if (resultsInfo.isSingleRow()) {
long rowCount = DBUtils.readRowCount(monitor, session.getExecutionContext(), dataContainer, null, this);
if (rowCount == 1) {
return;
}
}
DBDRowIdentifier rowIdentifier = resultsInfo.getDefaultRowIdentifier();
checkRowIdentifier(resultsInfo, rowIdentifier);
DBDAttributeBinding[] keyAttributes = rowIdentifier.getAttributes().toArray(new DBDAttributeBinding[0]);
Object[] rowValues = new Object[keyAttributes.length];
List<DBDAttributeConstraint> constraints = new ArrayList<>();