cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Jones <MJo...@imagehawk.com>
Subject RE: How to insert a row with a TimeUUIDType column in C++
Date Fri, 23 Apr 2010 15:51:56 GMT
std::string strUUID(uuid, 16) will do the right thing for you.

-----Original Message-----
From: Olivier Rosello [mailto:orosello@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 -+-
orosello@corp.free.fr -+- 1231, avenue du mondial 98 - 34000 Montpellier
Tel : +33 4 34 67 89 08 -+-


Mime
View raw message