0

How can I check if a given timeuuid i.e. fa6e9e80-299c-11e7-98d8-f7a8744353f3 is a valid timeuuid before query?

using a slighty different, yet still right format timeuuid: fa6e9e80-299c-11e7-98d8-f7a8744353av results in an error:

object(Cassandra\Exception\InvalidSyntaxException)#199 (7) { ["message":protected]=> string(54) "line 1:103 mismatched character 'v' expecting set null"

Cassandra PHP driver documentation does not seem to offer a valid function to check. ( https://datastax.github.io/php-driver/api/Cassandra/ )

1 Answers1

0

Check the version of the uuid using version() method. if 1 then it's timeuuid.

https://datastax.github.io/php-driver/api/Cassandra/interface.UuidInterface/#method-version

Ashraful Islam
  • 12,470
  • 3
  • 32
  • 53
  • Works somehow at least. I just need to check if it throws a exception on construct of timeuuid `new Cassandra\Uuid($timeuuid);` this will through an invalidArgumentException, if I try to initate it. There does not seem to be a proper way to check if it is infact a proper timeuuid in foresight. – Sven Neumann Apr 25 '17 at 14:22