Hi Nick,
On Wed, Apr 29, 2015 at 5:11 PM, Chris Bannister <
c.ban...@gmail.com> wrote:
> The reason for this (if the statement is being
> executed as per your previous email) as far as I can see is that the
> arguments are being passed as a single argument not as the full number of
> query params.
It's always helpful to have a complete (yet cut down) and runnable
example that demonstrates the behavior you are asking about.
In this case, Chris is having to assume stuff about your actual code.
On face value it looks like he might have done quite a good job:
1) "UPDATE keyspace.table SET value = ? WHERE id = ? and type = ? and
ts = ?” will not prepare because it is invalid CQL.
2) "UPDATE keyspace.table SET value = value + ? WHERE id = ? and type
= ? and ts = ?” is valid CQL, but you are passing in the wrong number
of arguments (assuming that you use the same code as the first
example, i.e. "session.Query(statement, args)" instead of
session.Query(statement, args...)
FWIW you can use bind variables to increment/decrement a counter
column, here is an example where this is done:
https://github.com/relops/cqlc/blob/master/cqlc/cqlc_test.go#L298
HTH,
Ben