Validate statements inside batch

This commit is contained in:
Sylvain Lebresne 2014-05-07 10:53:09 +02:00
parent 19ff1932cd
commit 2e61cd5e07
2 changed files with 3 additions and 4 deletions

View File

@ -128,6 +128,8 @@ public class BatchStatement implements CQLStatement, MeasurableForPreparedCache
{
if (timestampSet && statement.isTimestampSet())
throw new InvalidRequestException("Timestamp must be set either on BATCH or individual statements");
statement.validate(state);
}
}

View File

@ -155,7 +155,7 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF
public void validate(ClientState state) throws InvalidRequestException
{
if (hasConditions() && attrs.isTimestampSet())
throw new InvalidRequestException("Custom timestamps are not allowed when conditions are used");
throw new InvalidRequestException("Cannot provide custom timestamp for conditional update");
if (isCounter())
{
@ -765,9 +765,6 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF
if (stmt.isCounter())
throw new InvalidRequestException("Conditional updates are not supported on counter tables");
if (attrs.timestamp != null)
throw new InvalidRequestException("Cannot provide custom timestamp for conditional update");
if (ifNotExists)
{
// To have both 'IF NOT EXISTS' and some other conditions doesn't make sense.