CB-1303 Format updated values according to attribute type

This commit is contained in:
Serge Rider
2021-10-20 16:40:11 +03:00
parent 5d92706304
commit 57783f8e4c
2 changed files with 16 additions and 3 deletions
@@ -273,6 +273,8 @@ public class WebSQLProcessor {
DBSDataManipulator dataManipulator = generateUpdateResultsDataBatch(
monitor, contextInfo, resultsId, updatedRows, deletedRows, addedRows, dataFormat, resultBatches, keyReceiver);
WebSQLResultsInfo resultsInfo = contextInfo.getResults(resultsId);
long totalUpdateCount = 0;
WebSQLExecuteInfo result = new WebSQLExecuteInfo();
@@ -296,7 +298,7 @@ public class WebSQLProcessor {
// Patch result rows (adapt to web format)
for (int i = 0; i < rowValues.length; i++) {
rowValues[i] = WebSQLUtils.makeWebCellValue(webSession, null, rowValues[i], dataFormat);
rowValues[i] = WebSQLUtils.makeWebCellValue(webSession, resultsInfo.getAttributeByPosition(i), rowValues[i], dataFormat);
}
totalUpdateCount += statistics.getRowsUpdated();
@@ -319,7 +321,6 @@ public class WebSQLProcessor {
}
WebSQLQueryResultSet updatedResultSet = new WebSQLQueryResultSet();
WebSQLResultsInfo resultsInfo = contextInfo.getResults(resultsId);
updatedResultSet.setResultsInfo(resultsInfo);
updatedResultSet.setColumns(resultsInfo.getAttributes());
@@ -370,7 +371,8 @@ public class WebSQLProcessor {
@Nullable List<WebSQLResultsRow> deletedRows,
@Nullable List<WebSQLResultsRow> addedRows,
@Nullable WebDataFormat dataFormat,
@NotNull Map<DBSDataManipulator.ExecuteBatch, Object[]> resultBatches, DBDDataReceiver keyReceiver)
@NotNull Map<DBSDataManipulator.ExecuteBatch, Object[]> resultBatches,
@Nullable DBDDataReceiver keyReceiver)
throws DBException
{
WebSQLResultsInfo resultsInfo = contextInfo.getResults(resultsId);
@@ -24,6 +24,7 @@ import org.jkiss.dbeaver.model.data.DBDAttributeBinding;
import org.jkiss.dbeaver.model.data.DBDRowIdentifier;
import org.jkiss.dbeaver.model.struct.DBSAttributeBase;
import org.jkiss.dbeaver.model.struct.DBSDataContainer;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import java.util.List;
@@ -92,4 +93,14 @@ public class WebSQLResultsInfo {
}
return binding == null ? null : binding.getAttribute();
}
public DBSTypedObject getAttributeByPosition(int pos) {
for (DBDAttributeBinding attr : attributes) {
if (attr.getOrdinalPosition() == pos) {
return attr;
}
}
return null;
}
}