dbeaver/pro#8331 added sql generation for large objects (#4208)

* dbeaver/pro#8331 added sql generation for large objects

* dbeaver/pro#8331 check only relevant columns

---------

Co-authored-by: Ainur <59531286+yagudin10@users.noreply.github.com>
This commit is contained in:
Dmitrii Barnukov
2026-03-13 12:46:43 +01:00
committed by GitHub
co-authored by Ainur
parent cb8b1cfc52
commit 36d2b46496
@@ -31,6 +31,7 @@ import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DBUtils;
@@ -256,10 +257,38 @@ public class WebServiceSQL implements DBWServiceSQL {
@NotNull String resultsId,
@NotNull List<WebSQLResultsRow> selectedRows
) throws DBWebException {
checkAndFillTruncatedData(sqlContext, resultsId, selectedRows);
WebDBDResultSetDataProvider dataProvider = new WebDBDResultSetDataProvider(resultsId, sqlContext, selectedRows);
return createAndRunGenerator(webSession, generatorId, Collections.singletonList(dataProvider));
}
private void checkAndFillTruncatedData(
@NotNull WebSQLContextInfo sqlContext,
@NotNull String resultsId,
@NotNull List<WebSQLResultsRow> selectedRows
) throws DBWebException {
List<DBDAttributeBinding> attributes = Arrays.stream(sqlContext.getResults(resultsId).getAttributes())
.filter(attr -> canBeTruncated(attr.getDataKind()))
.toList();
for (WebSQLResultsRow row : selectedRows) {
Object[] data = row.getData();
for (DBDAttributeBinding attribute : attributes) {
int position = attribute.getOrdinalPosition();
boolean valueIsTruncated = data[position] != null &&
data[position].toString().length() == WebSQLConstants.TEXT_PREVIEW_MAX_LENGTH;
if (valueIsTruncated) {
data[position] = getCellValue(sqlContext, resultsId, position, row);
}
}
}
}
private boolean canBeTruncated(@NotNull DBPDataKind dataKind) {
return dataKind.equals(DBPDataKind.STRING) ||
dataKind.equals(DBPDataKind.CONTENT) ||
dataKind.equals(DBPDataKind.BINARY);
}
private String createAndRunGenerator(
@NotNull WebSession session,
@NotNull String generatorId,