0
我想使用DSC卡桑德拉3 aync更新,批量EXECUTE AS Aysnc不更新任何行
Integer count = 0;
String query = "select status, guid from catalog_new where affiliate_id = ? AND store_id =?";
String approveStoreQuery = "UPDATE catalog_new SET status = ? WHERE affiliate_id = ? AND store_id = ? AND guid = ?";
PreparedStatement selectStmt = session.prepare(query);
BoundStatement selectBoundStatement = new BoundStatement(selectStmt);
ResultSet selectSet = session.execute(selectBoundStatement.bind(new Object[]{affiliateId, storeId}));
BatchStatement batchStatement = new BatchStatement(BatchStatement.Type.UNLOGGED);
Iterator<Row> rowItr = selectSet.iterator();
while (!selectSet.isFullyFetched()) {
selectSet.fetchMoreResults();
Row row = rowItr.next();
if(row.getInt("status") == statusFrom){
String guid = row.getString("guid");
PreparedStatement preparedStatement = session.prepare(approveStoreQuery);
BoundStatement boundStatement = new BoundStatement(preparedStatement);
batchStatement.add(boundStatement.bind(new Object[]{statusTo, affiliateId, storeId, guid}));
count++;
}
}
session.executeAsync(batchStatement);
return count;
{这里是状态从-2和statusto是-2,IDS是3和9} 这不会更新任何行,我在这里做错了什么?
请提供表/ s的说明和报表。 – nevsv
'approveStoreQuery'的外观如何? –
你有没有得到任何错误? –