List<ModificationStatement> statements = new ArrayList<ModificationStatement>(queryOrIdList.size());
for (int i = 0; i < queryOrIdList.size(); i++)
{
Object query = queryOrIdList.get(i);
CQLStatement statement;
if (query instanceof String)
{
statement = QueryProcessor.parseStatement((String)query, state);
}
else
{
statement = QueryProcessor.getPrepared((MD5Digest)query);
if (statement == null)
throw new PreparedQueryNotFoundException((MD5Digest)query);
}
List<ByteBuffer> queryValues = values.get(i);
if (queryValues.size() != statement.getBoundsTerms())
throw new InvalidRequestException(String.format("There were %d markers(?) in CQL but %d bound variables",
statement.getBoundsTerms(),
queryValues.size()));
if (!(statement instanceof ModificationStatement))
throw new InvalidRequestException("Invalid statement in batch: only UPDATE, INSERT and DELETE statements are allowed.");
ModificationStatement mst = (ModificationStatement)statement;