std::string strUUID(uuid, 16) will do the right thing for you.

-----Original Message-----
From: Olivier Rosello [mailto:orose...@corp.free.fr]
Sent: Friday, April 23, 2010 9:59 AM
To: user@cassandra.apache.org
Subject: Re: How to insert a row with a TimeUUIDType column in C++

Le vendredi 23 avril 2010 à 08:30 -0500, Jonathan Ellis a écrit :
> want to look for a C++ library that deals
> with UUIDs.  Cassandra or Thrift aren't

Tank you for the response.

That's not the problem for me.

The problem is that new_col.column type is string.

uint8_t uuid[17];
uuid_generate_time(uuid); // returns a 16 bytes uuid v1
uuid[16] = 0;
ColumnPath new_col;
new_col.__isset.column = true; /* this is required! */
new_col.column_family.assign("Incoming");
new_col.column.assign((char *)uuid);
client.insert("MyKeyspace", "somekey", new_col, "Random Value",
time(NULL), ONE);

This works, except that sometimes, there are \0 bytes in uuid, so to
column.assign get a string shorter than 16 bytes...

My question is : how could I attribute the 16 bytes of uuid to column
without using a string ? :)


Cheers,

Olivier




--
Olivier Rosello -+- Free Mobile -+-
orose...@corp.free.fr -+- 1231, avenue du mondial 98 - 34000 Montpellier
Tel : +33 4 34 67 89 08 -+-

Reply via email to