Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 36104 invoked from network); 23 Apr 2010 17:52:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Apr 2010 17:52:45 -0000 Received: (qmail 83332 invoked by uid 500); 23 Apr 2010 16:03:23 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 83317 invoked by uid 500); 23 Apr 2010 16:03:23 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 83309 invoked by uid 99); 23 Apr 2010 16:03:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Apr 2010 16:03:23 +0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=AWL,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of MJones@imagehawk.com designates 67.63.148.114 as permitted sender) Received: from [67.63.148.114] (HELO ihedge.imagehawk.com) (67.63.148.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Apr 2010 16:03:17 +0000 Received: from ihcomm.ImageHawk.local (192.168.21.2) by mail.imagehawk.com (192.168.21.3) with Microsoft SMTP Server (TLS) id 8.0.813.0; Fri, 23 Apr 2010 11:03:29 -0500 Received: from ihcomm.ImageHawk.local ([192.168.20.2]) by ihcomm.ImageHawk.local ([192.168.20.2]) with mapi; Fri, 23 Apr 2010 10:59:58 -0500 From: Mark Jones To: "user@cassandra.apache.org" Date: Fri, 23 Apr 2010 11:02:27 -0500 Subject: RE: How to insert a row with a TimeUUIDType column in C++ Thread-Topic: How to insert a row with a TimeUUIDType column in C++ Thread-Index: Acri9RrqMcNOkdvYRxa8nfi2BlnGQQAB6y1wAABgm/A= Message-ID: References: <1272016790.4661.114.camel@neptune> <1272034714.4661.124.camel@neptune> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Turns out assign can be called with the length as well So mod your code to be new_col.column.assign((char *)uuid, 16); and you are fixed. -----Original Message----- From: Mark Jones [mailto:MJones@imagehawk.com] Sent: Friday, April 23, 2010 10:52 AM To: user@cassandra.apache.org Subject: RE: How to insert a row with a TimeUUIDType column in C++ 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 =E0 08:30 -0500, Jonathan Ellis a =E9crit : > 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] =3D 0; ColumnPath new_col; new_col.__isset.column =3D 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 -+-