SimpleStatement values not forwarded to QueryBuilder.batch()

Description

The following code fails with server error "Invalid amount of bind variables":

The QueryBuilder produces a batch with no values at all. Given how QueryBuilder works, I'm not sure we can support that, but we should detect the error before sending it to Cassandra, and return a better error message.

The workaround is to not use QueryBuilder:

Environment

None

Pull Requests

None

Activity

Show:
Sylvain Lebresne
August 7, 2014, 3:50 PM

Actually, I think we can handle it and in fact the code was suppose to, except that it was broken. The idea is simply that if we do have Statement that are not BuiltStatement in the batch, we don't do the "pass query builder values as binary value" business but instead always serialize query builder stuff as string. That way, we can just use the values of the SimpleStatement for the batch values. It's not all that important since we should be slowly pushing people to use BatchStatement rather than the querybuilder batches since it's overall better, but since we can handle it reasonably simply I've just fixed the code so it works as it should have. I've included a simple unit test too.

Fixed

Assignee

Sylvain Lebresne

Reporter

Olivier Michallat

Labels

None

PM Priority

None

Reproduced in

None

Affects versions

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Components

Priority

Minor
Configure