Skip to content

Commit 7a12ad4

Browse files
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 <[email protected]>
1 parent c39de17 commit 7a12ad4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLProcessor.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ private void readCellDataValue(
951951
DBCExecutionContext executionContext = getExecutionContext(dataContainer);
952952
try (DBCSession session = executionContext.openSession(monitor, DBCExecutionPurpose.USER, "Generate data update batches")) {
953953
DBDDataFilter dataFilter = new DBDDataFilter();
954-
addKeyAttributes(resultsInfo, row, dataContainer, session, dataFilter);
954+
addKeyAttributes(monitor, resultsInfo, row, dataContainer, session, dataFilter);
955955
WebExecutionSource executionSource = new WebExecutionSource(dataContainer, executionContext, this);
956956
dataContainer.readData(
957957
executionSource, session, dataReceiver, dataFilter,
@@ -960,16 +960,21 @@ private void readCellDataValue(
960960
}
961961

962962
private void addKeyAttributes(
963+
@NotNull DBRProgressMonitor monitor,
963964
@NotNull WebSQLResultsInfo resultsInfo,
964965
@NotNull WebSQLResultsRow row,
965966
@NotNull DBSDataContainer dataContainer,
966967
@NotNull DBCSession session,
967968
@NotNull DBDDataFilter dataFilter
968969
) throws DBException {
969-
DBDRowIdentifier rowIdentifier = resultsInfo.getDefaultRowIdentifier();
970-
if (rowIdentifier == null || rowIdentifier.isIncomplete()) {
971-
return;
970+
if (resultsInfo.isSingleRow()) {
971+
long rowCount = DBUtils.readRowCount(monitor, session.getExecutionContext(), dataContainer, null, this);
972+
if (rowCount == 1) {
973+
return;
974+
}
972975
}
976+
DBDRowIdentifier rowIdentifier = resultsInfo.getDefaultRowIdentifier();
977+
checkRowIdentifier(resultsInfo, rowIdentifier);
973978
DBDAttributeBinding[] keyAttributes = rowIdentifier.getAttributes().toArray(new DBDAttributeBinding[0]);
974979
Object[] rowValues = new Object[keyAttributes.length];
975980
List<DBDAttributeConstraint> constraints = new ArrayList<>();

0 commit comments

Comments
 (0)