CB-153 Batch update API

This commit is contained in:
Serge Rider
2020-06-23 10:42:29 +03:00
parent 511bfe3040
commit 42ba6f003f
3 changed files with 27 additions and 2 deletions
@@ -103,6 +103,11 @@ type SQLExecuteInfo {
results: [ SQLQueryResults! ]!
}
input SQLResultRow {
data: [ Object ]!
updateValues: [ Object ]
}
extend type Query {
sqlDialectInfo( connectionId: ID! ): SQLDialectInfo
@@ -152,6 +157,16 @@ extend type Mutation {
updateValues: Object
): SQLExecuteInfo
updateResultsDataBatch(
connectionId: ID!,
contextId: ID!,
resultsId: ID!,
updatedRows: [ SQLResultRow ],
deletedRows: [ SQLResultRow ],
addedRows: [ SQLResultRow ],
): SQLExecuteInfo
### Async API
# Returns SQLExecuteInfo
@@ -23,8 +23,6 @@ import io.cloudbeaver.model.WebAsyncTaskInfo;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSDataContainer;
import java.util.List;
import java.util.Map;
@@ -66,6 +64,13 @@ public interface DBWServiceSQL extends DBWService {
@NotNull List<Object> updateRow,
@NotNull Map<String, Object> updateValues) throws DBWebException;
@WebAction
WebSQLExecuteInfo updateResultsDataBatch(
@NotNull WebSQLContextInfo contextInfo,
@NotNull String resultsId,
@NotNull List<Object> updateRow,
@NotNull Map<String, Object> updateValues) throws DBWebException;
@WebAction
WebAsyncTaskInfo asyncExecuteQuery(@NotNull WebSQLContextInfo contextInfo, @NotNull String sql, @Nullable WebSQLDataFilter filter) throws DBException;
}
@@ -143,6 +143,11 @@ public class WebServiceSQL implements DBWServiceSQL {
return contextInfo.getProcessor().updateResultsData(contextInfo, resultsId, updateRow, updateValues);
}
@Override
public WebSQLExecuteInfo updateResultsDataBatch(@NotNull WebSQLContextInfo contextInfo, @NotNull String resultsId, @NotNull List<Object> updateRow, @NotNull Map<String, Object> updateValues) throws DBWebException {
throw new DBWebException("Not supported");
}
@NotNull
public WebAsyncTaskInfo asyncExecuteQuery(@NotNull WebSQLContextInfo contextInfo, @NotNull String sql, @Nullable WebSQLDataFilter filter) throws DBException {
DBRRunnableWithResult<WebSQLExecuteInfo> runnable = new DBRRunnableWithResult<WebSQLExecuteInfo>() {