0
を更新しないので、バッチAysnc私はDSCのカサンドラ3のaync更新を使用しようとしている任意の行
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;
を実行
は{ここstatusFromは-2とstatusto -2であり、IDは3,9である} これは行を更新しません、私はここで間違っていますか?
テーブル/ sの記述や文を入力してください。 – nevsv
'approveStoreQuery'はどのように見えますか? –
エラーが発生しましたか? –