0

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.

Suhas Bachhav
  • 403
  • 1
  • 7
  • 28

1 Answers1

1

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.

Alex Ott
  • 80,552
  • 8
  • 87
  • 132