Reputation: 1
Can someone please help me with the exact syntax to use prepared insert / update statements containing map type columns. suppose :
UPDATE abc SET map = map + ? where id = ?
where map is the map type column,
I found an answer Cassandra prepared statements with collections but it just contained the syntax to generate a particular map type object rather binding.
Upvotes: 0
Views: 446
Reputation: 87174
You need to execute it as usual for prepared queries, but you need to pass Cassandra::Map
object as first parameter, something like this:
$statement = $session->prepare('....')
$map = Cassandra\Type::map(Cassandra\Type::varchar(), Cassandra\Type::int())
->create('a', 1);
$id = 'something'
$session->execute($statement, array('arguments' => array($map, $id)));
You need to pass Map
object because CQL's appending to the map expects another map as an argument.
Upvotes: 1