From user-return-35010-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Wed Jul 3 03:09:18 2013 Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E81FC6C9 for ; Wed, 3 Jul 2013 03:09:18 +0000 (UTC) Received: (qmail 45951 invoked by uid 500); 3 Jul 2013 03:09:14 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 45932 invoked by uid 500); 3 Jul 2013 03:09:12 -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 45919 invoked by uid 99); 3 Jul 2013 03:09:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 03:09:10 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeremiah.jordan@gmail.com designates 209.85.223.169 as permitted sender) Received: from [209.85.223.169] (HELO mail-ie0-f169.google.com) (209.85.223.169) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 03:09:05 +0000 Received: by mail-ie0-f169.google.com with SMTP id 10so14521295ied.0 for ; Tue, 02 Jul 2013 20:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:message-id:mime-version:subject:date:references :to:in-reply-to:x-mailer; bh=5aaEeF/CFpPYa+tu7sR5fAHBPqTANxVoWLufhgfwmBY=; b=KezibRl+Hd8DeVCA1rbsRCYVDLDZaAlkGnFWsOjCk/KeEgxC+q8+WJps2QwhHdzdRX uGxGKURxTpclKbqQZ4MEt3bLch8Y6fue9qPZpIBWL3hpSzT05ksuTdXePvq2iN5aykUA 551ocz2oSbA1H9veeb2ZcjRmu8u4XN0La9SLvFqYLUmjul3925VjlLFOC5QwyrYwajqS rbj1y7tTyaAr2J5jisLXfmZingP/r7137HAZNcTbkVad777De8aHx24B2a+0SaDcbQc4 K/lvcZdnELGDhW+KbDSc6ibboVgvaLYx2hFiKmTJT3xN3JM2F2V16sj8HWRAdp/FQem1 KcFw== X-Received: by 10.42.119.73 with SMTP id a9mr890493icr.54.1372820924945; Tue, 02 Jul 2013 20:08:44 -0700 (PDT) Received: from [192.168.2.10] (c-71-201-190-179.hsd1.il.comcast.net. [71.201.190.179]) by mx.google.com with ESMTPSA id qn10sm21921496igc.6.2013.07.02.20.08.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Jul 2013 20:08:43 -0700 (PDT) From: Jeremiah D Jordan Content-Type: multipart/alternative; boundary="Apple-Mail=_65351D40-A4C7-4A75-8D3A-3DEE788B1375" Message-Id: <165D0FD6-D9D4-4981-A5A6-A7FE02BB4BC2@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: Problem with libcassandra Date: Tue, 2 Jul 2013 22:08:44 -0500 References: To: user@cassandra.apache.org In-Reply-To: X-Mailer: Apple Mail (2.1508) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_65351D40-A4C7-4A75-8D3A-3DEE788B1375 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 If you are using 1.2, I would checkout https://github.com/mstump/libcql -Jeremiah On Jul 2, 2013, at 5:18 AM, Shubham Mittal = wrote: > I am trying to run below code, but it gives this error. It compiles = without any errors. Kindly help me. > (source of the code : = http://posulliv.github.io/2011/02/27/libcassandra-sec-indexes/) >=20 > terminate called after throwing an instance of = 'org::apache::cassandra::InvalidRequestException' > what(): Default TException. > Aborted >=20 >=20 > #include > #include > #include > #include > #include > #include > #include > #include >=20 > #include > #include > #include > #include > #include >=20 > using namespace std; > using namespace libcassandra; >=20 > static string host("127.0.0.1"); > static int port=3D 9160; >=20 > int main() > { >=20 > CassandraFactory cf(host, port); > tr1::shared_ptr c(cf.create()); >=20 > KeyspaceDefinition ks_def; > ks_def.setName("demo"); > c->createKeyspace(ks_def); > =20 > ColumnFamilyDefinition cf_def; > cf_def.setName("users"); > cf_def.setKeyspaceName(ks_def.getName()); > =20 > ColumnDefinition name_col; > name_col.setName("full_name"); > name_col.setValidationClass("UTF8Type"); > =20 > ColumnDefinition sec_col; > sec_col.setName("birth_date"); > sec_col.setValidationClass("LongType"); > sec_col.setIndexType(org::apache::cassandra::IndexType::KEYS); > =20 > ColumnDefinition third_col; > third_col.setName("state"); > third_col.setValidationClass("UTF8Type"); > third_col.setIndexType(org::apache::cassandra::IndexType::KEYS); > =20 > cf_def.addColumnMetadata(name_col); > cf_def.addColumnMetadata(sec_col); > cf_def.addColumnMetadata(third_col); > =20 > c->setKeyspace(ks_def.getName()); > c->createColumnFamily(cf_def); > =20 > return 0; > } >=20 --Apple-Mail=_65351D40-A4C7-4A75-8D3A-3DEE788B1375 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=iso-8859-1 If you are using 1.2, I would checkout https://github.com/mstump/libcql

-Jeremiah

On Jul 2, 2013, at 5:18 AM, Shubham Mittal <smsmittal14@gmail.com> wrote:

I am trying to run below code, but it gives this error. It compiles without any errors.  Kindly help me.
(source of the code : http://posulliv.github.io/2011/02/27/libcassandra-sec-indexes/)

terminate called after throwing an instance of 'org::apache::cassandra::InvalidRequestException'
  what():  Default TException.
Aborted


#include <string.h>
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <set>
#include <string>
#include <stdio.h>
#include <vector>

#include <libcassandra/cassandra_factory.h>
#include <libcassandra/cassandra.h>
#include <libcassandra/column_family_definition.h>
#include <libcassandra/keyspace.h>
#include <libcassandra/keyspace_definition.h>

using namespace std;
using namespace libcassandra;

static string host("127.0.0.1");
static int port= 9160;

int main()
{

    CassandraFactory cf(host, port);
    tr1::shared_ptr<Cassandra> c(cf.create());

    KeyspaceDefinition ks_def;
    ks_def.setName("demo");
    c->createKeyspace(ks_def);
    
    ColumnFamilyDefinition cf_def;
    cf_def.setName("users");
    cf_def.setKeyspaceName(ks_def.getName());
    
    ColumnDefinition name_col;
    name_col.setName("full_name");
    name_col.setValidationClass("UTF8Type");
    
    ColumnDefinition sec_col;
    sec_col.setName("birth_date");
    sec_col.setValidationClass("LongType");
    sec_col.setIndexType(org::apache::cassandra::IndexType::KEYS);
    
    ColumnDefinition third_col;
    third_col.setName("state");
    third_col.setValidationClass("UTF8Type");
    third_col.setIndexType(org::apache::cassandra::IndexType::KEYS);
    
    cf_def.addColumnMetadata(name_col);
    cf_def.addColumnMetadata(sec_col);
    cf_def.addColumnMetadata(third_col);
    
    c->setKeyspace(ks_def.getName());
    c->createColumnFamily(cf_def);
    
    return 0;
}


--Apple-Mail=_65351D40-A4C7-4A75-8D3A-3DEE788B1375--