use of org.apache.ignite.internal.processors.cache.QueryCursorImpl in project ignite by apache.
the class DmlStatementsProcessor method updateSqlFieldsDistributed.
/**
* @param schemaName Schema.
* @param c Connection.
* @param p Prepared statement.
* @param fieldsQry Initial query
* @param cancel Query cancel.
* @return Update result wrapped into {@link GridQueryFieldsResult}
* @throws IgniteCheckedException if failed.
*/
@SuppressWarnings("unchecked")
List<QueryCursorImpl<List<?>>> updateSqlFieldsDistributed(String schemaName, Connection c, Prepared p, SqlFieldsQuery fieldsQry, GridQueryCancel cancel) throws IgniteCheckedException {
if (DmlUtils.isBatched(fieldsQry)) {
Collection<UpdateResult> ress = updateSqlFieldsBatched(schemaName, c, p, (SqlFieldsQueryEx) fieldsQry, false, null, cancel);
ArrayList<QueryCursorImpl<List<?>>> resCurs = new ArrayList<>(ress.size());
for (UpdateResult res : ress) {
checkUpdateResult(res);
QueryCursorImpl<List<?>> resCur = (QueryCursorImpl<List<?>>) new QueryCursorImpl(Collections.singletonList(Collections.singletonList(res.counter())), cancel, false);
resCur.fieldsMeta(UPDATE_RESULT_META);
resCurs.add(resCur);
}
return resCurs;
} else {
UpdateResult res = updateSqlFields(schemaName, c, p, fieldsQry, false, null, cancel);
ArrayList<QueryCursorImpl<List<?>>> resCurs = new ArrayList<>(1);
checkUpdateResult(res);
QueryCursorImpl<List<?>> resCur = (QueryCursorImpl<List<?>>) new QueryCursorImpl(Collections.singletonList(Collections.singletonList(res.counter())), cancel, false);
resCur.fieldsMeta(UPDATE_RESULT_META);
resCurs.add(resCur);
return resCurs;
}
}
Aggregations