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;
if (mst.isCounter())
{
if (type != BatchStatement.Type.COUNTER)
throw new InvalidRequestException("Cannot include counter statement in a non-counter batch");
}
else
{
if (type == BatchStatement.Type.COUNTER)
throw new InvalidRequestException("Cannot include non-counter statement in a counter batch");
}
statements.add(mst);
}
// Note: It's ok at this point to pass a bogus value for the number of bound terms in the BatchState ctor