In C++ you need to set .__isset.fieldname on optional fields (e.g.
.__isset.value).

2011/8/13 Hassapis Constantinos <cha...@ics.forth.gr>:
> Hi all,
>
> I'm using Cassandra 0.8.3 and thrift for c++ and I can't insert column in
> a column family. Starting from an empty keyspace first I add a new
> keyspace and then a new column family and that works fine but I can't
> insert a column.
> The code that I have written is:
>
>                transport->open();
>                KsDef ks_def;
>
>                ks_def.name = "test_keyspace";
>                ks_def.replication_factor = 0;
>                ks_def.strategy_class = "LocalStrategy";
>                std::string res;
>
>                cout << "add keyspace.." << endl;
>                client.system_add_keyspace( res, ks_def);
>                client.set_keyspace("test_keyspace");
>
>                cout << "add column family.." << endl;
>                CfDef cf_def;
>                cf_def.keyspace= "test_keyspace";
>                cf_def.name = "cf_name_test";
>                client.system_add_column_family( res, cf_def );
>
>                const string& key="test_key";
>                const string value="valueeee_";
>
>                ColumnParent cparent;
>                cparent.column_family = "cf_name_test";
>
>                Column c;
>                c.name =  "column_namess";
>                c.value =  value;
>                c.timestamp = getTS();
>
>                cout << "insert key value:"<< c.value << endl;
>                client.insert( key, cparent, c, ConsistencyLevel::ONE);
>
>                cout << "drop column family" << endl;
>                client.system_drop_column_family( res, "cf_name_test");
>
>                cout << "drop keyspace" << endl;
>                client.system_drop_keyspace( res, "test_keyspace");
>
>                transport->close();
>
> and I recive the bellow Exception: Default TException.  [Column value is
> required] as you can see from the source code I have fill the value of the
> column.
>
> thank you in advance for your help.
> Konstantinos Chasapis
> p.s please cc me in the reply.
>
>
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Reply via email to